J'essaie d'automatiser une application hybride Android, mais j'obtiens les erreurs suivantes:
1) Exception dans le fil "principal" org.openqa.Selenium.WebDriverException: Il est impossible de créer une nouvelle session car 'createSession' qui prend HttpClient, InputStream et longtemps n'a pas été trouvé ou n'est pas accessible.
2) Causée par: Java.lang.reflect.InvocationTargetException
3) Causée par: org.openqa.Selenium.WebDriverException: Aucun contexte de ce type n'a été trouvé.
4) NoSuchContextError: aucun contexte de ce type n'a été trouvé.
Voici le code que je tente d’exécuter
package Demo;
import Java.net.MalformedURLException;
import Java.net.URL;
import Java.util.Set;
import org.openqa.Selenium.By;
import org.openqa.Selenium.remote.CapabilityType;
import org.openqa.Selenium.remote.DesiredCapabilities;
import io.appium.Java_client.AppiumDriver;
import io.appium.Java_client.MobileElement;
import io.appium.Java_client.Android.AndroidDriver;
public class NewTest {
private static AndroidDriver<MobileElement> driver;
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
capabilities.setCapability("deviceName", "ZY223ZMPG6");
capabilities.setCapability("platformVersion", "7.0");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("autoGrantPermissions","true");
capabilities.setCapability("appPackage", "com.equationswork.enis");
capabilities.setCapability("appActivity", "com.equationswork.enis.MainActivity");
capabilities.setCapability("--session-override","true");
capabilities.setCapability("autoWebview","true");
capabilities.setCapability("chromedriverExecutable","C:\\Users\\Anjani \\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-chromedriver\\chromedriver\\win\\chromedriver.exe");
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
//driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
Thread.sleep(5000);
//System.out.println(driver.getPageSource());
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextNames); //prints out something like NATIVE_APP \n WEBVIEW_1
}
driver.context((String) contextNames.toArray()[1]);
driver.context("WEBVIEW_1");
driver.findElement(By.id("btnGuest")).click();
//driver.quit();
}
}
Following are the errors thrown:
Exception in thread "main" org.openqa.Selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
System info: Host: 'DESKTOP-LAHP4RL', ip: '10.0.0.65', os.name: 'Windows 10', os.Arch: 'AMD64', os.version: '10.0', Java.version: '1.8.0_171'
Driver info: driver.version: AndroidDriver
at io.appium.Java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.Java:182)
at io.appium.Java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.Java:196)
at io.appium.Java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.Java:218)
at org.openqa.Selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.Java:543)
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 org.openqa.Selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.Java:207)
at org.openqa.Selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.Java:130)
at io.appium.Java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.Java:38)
at io.appium.Java_client.AppiumDriver.<init>(AppiumDriver.Java:84)
at io.appium.Java_client.AppiumDriver.<init>(AppiumDriver.Java:94)
at io.appium.Java_client.Android.AndroidDriver.<init>(AndroidDriver.Java:88)
at Demo.NewTest.main(NewTest.Java:31)
Caused by: Java.lang.reflect.InvocationTargetException
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at Java.lang.reflect.Method.invoke(Unknown Source)
at io.appium.Java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.Java:172)
... 13 more
Caused by: org.openqa.Selenium.WebDriverException: No such context found.
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
System info: Host: 'DESKTOP-LAHP4RL', ip: '10.0.0.65', os.name: 'Windows 10', os.Arch: 'AMD64', os.version: '10.0', Java.version: '1.8.0_171'
Driver info: driver.version: AndroidDriver
remote stacktrace: NoSuchContextError: No such context found.
at AndroidDriver.callee$0$0$ (C:\Users\Anjani\AppData\Roaming\npm\node_modules\appium\node_modules\appium-Android-driver\lib\commands\context.js:49:11)
at tryCatch (C:\Users\Anjani\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\Anjani\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\Anjani\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\Anjani\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
at <anonymous>
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.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.Java:57)
at org.openqa.Selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.Java:104)
at org.openqa.Selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.Java:123)
at Java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at Java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at Java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at Java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at Java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at Java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at Java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at Java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at Java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.Selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.Java:126)
... 18 more
Following is the Selenium server log
[Appium] Welcome to Appium v1.8.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":"com.equationswork.enis.MainActivity","appPackage":"com.equationswork.enis","chromedriverExecutable":"C:\\Users\\Anjani\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-chromedriver\\chromedriver\\win\\chromedriver.exe","platformVersion":"7.0","autoGrantPermissions":"true","browserName":"Android","--session-override":"true","autoWebview":"true","platformName":"Android","deviceName":"ZY223ZMPG6"},"capabilities":{"desiredCapabilities":{"appActivity":"com.equationswork.enis.MainActivity","appPackage":"com.equationswork.enis","chromedriverExecutable":"C:\\Users\\Anjani\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-chromedriver\\chromedriver\\win\\chromedriver.exe","platformVersion":"7.0","autoGrantPermissions":"true","browserName":"Android","--session-override":"true","autoWebview":"true","platformName":"Android","deviceName":"ZY223ZMPG6"},"firstMatch":[{"--session-override":"true","appium:appActivity":"com.equati
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.equationswork.enis.MainActivity","appPackage":"com.equationswork.enis","chromedriverExecutable":"C:\\Users\\Anjani\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-chromedriver\\chromedriver\\win\\chromedriver.exe","platformVersion":"7.0","autoGrantPermissions":"true","browserName":"Android","--session-override":"true","autoWebview":"true","platformName":"Android","deviceName":"ZY223ZMPG6"},null,{"desiredCapabilities":{"appActivity":"com.equationswork.enis.MainActivity","appPackage":"com.equationswork.enis","chromedriverExecutable":"C:\\Users\\Anjani\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-chromedriver\\chromedriver\\win\\chromedriver.exe","platformVersion":"7.0","autoGrantPermissions":"true","browserName":"Android","--session-override":"true","autoWebview":"true","platformName":"Android","deviceName":"ZY223ZMPG6"},"firstMatch":[{"--session-override":"true","appium:appActivity":"com.equationswork.enis.MainActivity","appium:appPackage":"com.e...
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1528700143344 (12:25:43 GMT+0530 (India Standard Time))
[BaseDriver] The capabilities ["--session-override"] are not standard capabilities and should have an extension prefix
[BaseDriver] Boolean capability passed in as string. Functionality may be compromised.
[Appium] Consider setting 'automationName' capability to 'uiautomator2' on Android >= 6, since UIAutomator framework is not maintained anymore by the OS vendor.
[Appium] Creating new AndroidDriver (v2.4.1) session
[Appium] Capabilities:
[Appium] --session-override: true
[Appium] browserName: Android
[Appium] platformName: Android
[Appium] appActivity: com.equationswork.enis.MainActivity
[Appium] appPackage: com.equationswork.enis
[Appium] autoGrantPermissions: true
[Appium] autoWebview: true
[Appium] chromedriverExecutable: C:\Users\Anjani\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
[Appium] deviceName: ZY223ZMPG6
[Appium] platformVersion: 7.0
[debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"appium:--s... and MJSONWP desired capabilities [object Object] were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"appium:--s...
[BaseDriver] Boolean capability passed in as string. Functionality may be compromised.
[BaseDriver] Boolean capability passed in as string. Functionality may be compromised.
[BaseDriver] Capability 'autoWebview' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'autoGrantPermissions' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] The following capabilities were provided, but are not recognized by appium: --session-override.
[BaseDriver] Session created with session id: e5ce581e-243f-4a72-bc16-f2d84070f32b
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_171
[ADB] Checking whether adb is present
[ADB] Found 1 'build-tools' folders under 'C:\Users\Anjani\AppData\Local\Android\sdk' (newest first):
[ADB] C:/Users/Anjani/AppData/Local/Android/sdk/build-tools/23.0.3
[ADB] Using adb.exe from C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected Android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[AndroidDriver] Looking for a device with Android '7.0'
[debug] [ADB] Setting device id to ZY223ZMPG6
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 7.0
[AndroidDriver] Using device: ZY223ZMPG6
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe
[debug] [ADB] Setting device id to ZY223ZMPG6
[AndroidDriver] App file was not listed, instead we're going to run com.equationswork.enis directly on the device
[debug] [AndroidDriver] Checking whether package is present on the device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell pm list packages com.equationswork.enis'
[AndroidDriver] Starting Android session
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 wait-for-device'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell echo ping'
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell pm list packages io.appium.settings'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.settings'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell dumpsys package io.appium.settings'
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Users\Anjani\AppData\Local\Android\sdk\build-tools\23.0.3\aapt.exe
[debug] [ADB] The installed 'io.appium.settings' package does not require upgrade ('2.3.0' >= '2.3.0')
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell ps'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell getprop ro.build.version.sdk'
[debug] [ADB] Current device property 'ro.build.version.sdk': 24
[debug] [ADB] Device API level: 24
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell am start -W -n io.appium.settings/.Settings -a Android.intent.action.MAIN -c Android.intent.category.LAUNCHER -f 0x10200000'[debug] [ADB] Device API level: 24
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell appops set io.appium.settings Android\:mock_location allow'
[AndroidDriver] setDeviceLanguageCountry requires language or country.
[AndroidDriver] Got language: 'null' and country: 'null'
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Pushing unlock helper app to device...
[debug] [ADB] Getting install status for io.appium.unlock
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell pm list packages io.appium.unlock'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.unlock'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell dumpsys package io.appium.unlock'
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Users\Anjani\AppData\Local\Android\sdk\build-tools\23.0.3\aapt.exe
[debug] [ADB] The installed 'io.appium.unlock' package does not require upgrade ('2.0.0' >= '2.0.0')
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 7.0
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell wm size'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell getprop ro.product.model'
[debug] [ADB] Current device property 'ro.product.model': Moto G (5) Plus
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell getprop ro.product.manufacturer'
[debug] [ADB] Current device property 'ro.product.manufacturer': Motorola
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [AndroidDriver] No app capability. Assuming it is already on the device
[debug] [ADB] Getting install status for com.equationswork.enis
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell pm list packages com.equationswork.enis'
[debug] [ADB] App is installed
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell am force-stop com.equationswork.enis'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell pm clear com.equationswork.enis'
[debug] [ADB] Device API level: 24
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell dumpsys package com.equationswork.enis'
[debug] [AndroidDriver] Performed fast reset on the installed 'com.equationswork.enis' application (stop and clear)
[debug] [AndroidBootstrap] Watching for bootstrap disconnect
[debug] [ADB] Forwarding system: 4724 to device: 4724
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 forward tcp\:4724 tcp\:4724'
[debug] [UiAutomator] Starting UiAutomator
[debug] [UiAutomator] Moving to state 'starting'
[debug] [UiAutomator] Parsing uiautomator jar
[debug] [UiAutomator] Found jar name: 'AppiumBootstrap.jar'
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Push C\:\\Users\\Anjani\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-Android-bootstrap\\bootstrap\\bin\\AppiumBootstrap.jar /data/local/tmp/'
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell ps'
[ADB] No uiautomator process found to kill, continuing...
[debug] [UiAutomator] Starting UIAutomator
[debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","ZY223ZMPG6","Shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.Android.bootstrap.Bootstrap","-e","pkg","com.equationswork.enis","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false]
[debug] [UiAutomator] Moving to state 'online'
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Loading json...
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.
[AndroidBootstrap] Android bootstrap socket is now connected
[debug] [ADB] Getting connected devices...
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing
[debug] [ADB] Device API level: 24
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell am start -W -n com.equationswork.enis/com.equationswork.enis.MainActivity -S -a Android.intent.action.MAIN -c Android.intent.category.LAUNCHER -f 0x10200000'
[AndroidDriver] Setting auto webview to context 'WEBVIEW_com.equationswork.enis' with timeout 2000ms
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell cat /proc/net/unix'
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_chrome"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_chrome"]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell cat /proc/net/unix'
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_chrome"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_chrome"]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell cat /proc/net/unix'
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_chrome"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_chrome"]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell cat /proc/net/unix'
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_chrome"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_chrome"]
[debug] [AndroidDriver] Shutting down Android driver
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell am force-stop com.equationswork.enis'
[debug] [ADB] Pressing the HOME button
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell input keyevent 3'
[debug] [AndroidBootstrap] Sending command to Android: {"cmd":"shutdown"}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [UiAutomator] Shutting down UiAutomator
[debug] [UiAutomator] Moving to state 'stopping'
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.Android.bootstrap.Bootstrap
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Time: 5.426
[debug] [AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1
[debug] [UiAutomator] UiAutomator shut down normally
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell ps'
[ADB] No uiautomator process found to kill, continuing...
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Anjani\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s ZY223ZMPG6 Shell am force-stop io.appium.unlock'
[debug] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1528700164410 (12:26:04 GMT+0530 (India Standard Time))
[HTTP] <-- POST /wd/hub/session 400 21093 ms - 1026
[HTTP]
Aller à l'option de développeur et activer les options ci-dessous -
Débogage USB - Mode débogage lorsque l'USB est connecté
Installer via USB - Autoriser l'installation d'applications via USB
Débogage USB (Paramètres de sécurité) - Autorise l’octroi d’autorisations et la simulation d’une entrée via le débogage USB.
Cela a fonctionné pour moi.
commande d'exécution: appium-doctor
analyser s'il y a un problème Java_Home et Android_Home
aller au profil bash et enregistrez-le à nouveau
do: gradle build si il y a un problème de détection de périphérique ou de périphérique mémoire, voir les journaux prennent un nouvel émulateur dans ce cas
lancez votre projet
Cela a fonctionné pour moi
J'espère que vous avez démarré le serveur appium, que vous utilisiez peut-être les mêmes URL et port que pour initialiser l'objet du pilote . Une dernière chose, veuillez en utiliser une pour chaque boucle afin de changer de contexte à l'aide de string.contains ("WEBVIEW")
S'il existe déjà un serveur Appium en cours d'exécution sur la même adresse IP et sur le même port, ce message d'erreur s'affiche. Assurez-vous de fermer tous les serveurs appium avant d'essayer de le démarrer ou vous pouvez spécifier un nouveau port pour chaque serveur appium par programme.
Les journaux Appium indiquent que le problème est lié aux capacités et I Supposons dans votre chemin, après "\ Anjani", qu'il y ait un espace dans les capacités souhaitées . Cela peut être la raison.
("chromedriverExecutable","C:\\Users\\Anjani \\AppData\\....")
Dans mon cas, j'avais mis "NO_Reset=false**e**" (with double "e" )
J'espère que ça aide.