Я получаю этот код ошибки и не могу найти решение:
Exception in thread "main" org.openqa.selenium.NoSuchSessionException: A session is either terminated or not started
Я пытался найти некоторую информацию в Интернете, но не нашел ничего по моей проблеме.
Я пытаюсь автоматизировать небольшую часть игры Epic Seven, используя appium и некоторые жестко закодированные переменные. Я не знаю, есть ли какие-либо проблемы с моими возможностями, но думаю, что нет, потому что в сеансе Inspector они отлично работают. Поэтому я думаю, что проблема в моем коде, логике или установке драйверов.
Мой код:
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Scanner;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.touch.offset.PointOption;
public class main {
public static DesiredCapabilities init() {
// "platformName": "Android",
// "deviceName": "HUAWEI P10",
// "appPackage": "com.stove.epic7.google",
// "appActivity": "kr.supercreative.epic7.AppActivity",
// "noReset": true,
// "skipDeviceInitialization": true,
// "skipServerInstallation": true
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "HUAWEI P10");
caps.setCapability("udid", "6PQ0217829002238"); //Give Device ID of your mobile phone
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.0.0");
caps.setCapability("appPackage", "com.stove.epic7.google");
caps.setCapability("appActivity", "kr.supercreative.epic7.AppActivity");
caps.setCapability("noReset", "true");
caps.setCapability("skipServerInstallation", true);
caps.setCapability("clearSystemFiles", false);
return caps;
}
public static void main(String[] args) throws InterruptedException {
Scanner input = new Scanner(System.in);
try {
AppiumDriver mygame = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), init());
int x = 1;
while(x != -1) {
x = input.nextInt();
TouchAction touchAction = new TouchAction(mygame);
for(int i = 0; i < x; i++) {
//select team + supp
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
//start quest
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
//buy energy
touchAction.tap(new PointOption().withCoordinates(1076, 772)).perform();
//start quest again if energie empty
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
//wait for finishing mission
for(int j = 0; j < 4;j++) {
Thread.sleep(1000 * 30 * 2);
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
}
Thread.sleep(1000 * 60 * 2);
//clear stage tap anywhere
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
//confirm mvp
touchAction.tap(new PointOption().withCoordinates(1740, 994)).perform();
//play again
touchAction.tap(new PointOption().withCoordinates(1740, 994)).perform();
}
}
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
}
}
А вот мой журнал ошибок в Eclipse:
Exception in thread "main" org.openqa.selenium.NoSuchSessionException: A session is either terminated or not started
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'LAPTOPMARTIN', ip: '192.168.178.21', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_211'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: kr.supercreative.epic7.AppA..., appPackage: com.stove.epic7.google, clearSystemFiles: false, databaseEnabled: false, desired: {appActivity: kr.supercreative.epic7.AppA..., appPackage: com.stove.epic7.google, clearSystemFiles: false, deviceName: HUAWEI P10, noReset: true, platformName: android, platformVersion: 8.0.0, skipServerInstallation: true, udid: 6PQ0217829002238}, deviceManufacturer: HUAWEI, deviceModel: VTR-L09, deviceName: 6PQ0217829002238, deviceScreenSize: 1080x1920, deviceUDID: 6PQ0217829002238, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, platform: LINUX, platformName: Android, platformVersion: 8.0.0, skipServerInstallation: true, takesScreenshot: true, udid: 6PQ0217829002238, warnings: {}, webStorageEnabled: false}
Session ID: 1341c917-75bc-4988-a5bf-854c9affb81f
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at io.appium.java_client.PerformsTouchActions.performTouchAction(PerformsTouchActions.java:41)
at io.appium.java_client.TouchAction.perform(TouchAction.java:187)
at test.main.main(main.java:65)
Подробнее здесь: https://stackoverflow.com/questions/559 ... ot-started
Исправьте ошибку приложения: «Сеанс либо завершен, либо не запущен». ⇐ Android
Форум для тех, кто программирует под Android
1767776715
Anonymous
Я получаю этот код ошибки и не могу найти решение:
Exception in thread "main" org.openqa.selenium.NoSuchSessionException: A session is either terminated or not started
Я пытался найти некоторую информацию в Интернете, но не нашел ничего по моей проблеме.
Я пытаюсь автоматизировать небольшую часть игры Epic Seven, используя appium и некоторые жестко закодированные переменные. Я не знаю, есть ли какие-либо проблемы с моими возможностями, но думаю, что нет, потому что в сеансе Inspector они отлично работают. Поэтому я думаю, что проблема в моем коде, логике или установке драйверов.
Мой код:
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Scanner;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.touch.offset.PointOption;
public class main {
public static DesiredCapabilities init() {
// "platformName": "Android",
// "deviceName": "HUAWEI P10",
// "appPackage": "com.stove.epic7.google",
// "appActivity": "kr.supercreative.epic7.AppActivity",
// "noReset": true,
// "skipDeviceInitialization": true,
// "skipServerInstallation": true
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "HUAWEI P10");
caps.setCapability("udid", "6PQ0217829002238"); //Give Device ID of your mobile phone
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.0.0");
caps.setCapability("appPackage", "com.stove.epic7.google");
caps.setCapability("appActivity", "kr.supercreative.epic7.AppActivity");
caps.setCapability("noReset", "true");
caps.setCapability("skipServerInstallation", true);
caps.setCapability("clearSystemFiles", false);
return caps;
}
public static void main(String[] args) throws InterruptedException {
Scanner input = new Scanner(System.in);
try {
AppiumDriver mygame = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), init());
int x = 1;
while(x != -1) {
x = input.nextInt();
TouchAction touchAction = new TouchAction(mygame);
for(int i = 0; i < x; i++) {
//select team + supp
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
//start quest
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
//buy energy
touchAction.tap(new PointOption().withCoordinates(1076, 772)).perform();
//start quest again if energie empty
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
//wait for finishing mission
for(int j = 0; j < 4;j++) {
Thread.sleep(1000 * 30 * 2);
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
}
Thread.sleep(1000 * 60 * 2);
//clear stage tap anywhere
touchAction.tap(new PointOption().withCoordinates(1400, 950)).perform();
//confirm mvp
touchAction.tap(new PointOption().withCoordinates(1740, 994)).perform();
//play again
touchAction.tap(new PointOption().withCoordinates(1740, 994)).perform();
}
}
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
}
}
А вот мой журнал ошибок в Eclipse:
Exception in thread "main" org.openqa.selenium.NoSuchSessionException: A session is either terminated or not started
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'LAPTOPMARTIN', ip: '192.168.178.21', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_211'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: kr.supercreative.epic7.AppA..., appPackage: com.stove.epic7.google, clearSystemFiles: false, databaseEnabled: false, desired: {appActivity: kr.supercreative.epic7.AppA..., appPackage: com.stove.epic7.google, clearSystemFiles: false, deviceName: HUAWEI P10, noReset: true, platformName: android, platformVersion: 8.0.0, skipServerInstallation: true, udid: 6PQ0217829002238}, deviceManufacturer: HUAWEI, deviceModel: VTR-L09, deviceName: 6PQ0217829002238, deviceScreenSize: 1080x1920, deviceUDID: 6PQ0217829002238, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, platform: LINUX, platformName: Android, platformVersion: 8.0.0, skipServerInstallation: true, takesScreenshot: true, udid: 6PQ0217829002238, warnings: {}, webStorageEnabled: false}
Session ID: 1341c917-75bc-4988-a5bf-854c9affb81f
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at io.appium.java_client.PerformsTouchActions.performTouchAction(PerformsTouchActions.java:41)
at io.appium.java_client.TouchAction.perform(TouchAction.java:187)
at test.main.main(main.java:65)
Подробнее здесь: [url]https://stackoverflow.com/questions/55995876/fix-this-appium-error-a-session-is-either-terminated-or-not-started[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия