简体   繁体   English

无法检测 webview Appium

[英]Can't detect webview Appium

I am trying to automate an hybrid phonegap application through Appium.我正在尝试通过 Appium 自动化混合 phonegap 应用程序。 While this app is running on a phone I can access it remotely through the Chrome browser.当这个应用程序在手机上运行时,我可以通过 Chrome 浏览器远程访问它。 When I use Appium it doesn't show the webview context and only displays the native context.当我使用 Appium 时,它不显示 webview 上下文,只显示本机上下文。 Is there a way to access the webview context and what am I doing wrong?有没有办法访问 webview 上下文,我做错了什么?

        var dirs = Directory.GetFiles("out", "*.apk");
        var app = Path.GetFullPath(dirs[0]);
        DesiredCapabilities cap = new DesiredCapabilities();
        cap.SetCapability("fastReset", "True");
        cap.SetCapability("platformName", "Android");
        cap.SetCapability("automationName", "Appium");
        cap.SetCapability("app", app);
        cap.SetCapability("deviceName", "emulator-5554");
        cap.SetCapability("autoGrantPermissions", "true");
        AppiumDriver<AppiumWebElement> driver1 = new AndroidDriver<AppiumWebElement>(new Uri("http://192.168.1.138:4723/wd/hub"),cap);
        Thread.Sleep(15000);
        var contexts = driver1.Contexts;
        foreach(string context in contexts)
        {
            if (context.Contains("WEBVIEW"))
            {
                driver1.Context = context;
                break;
            }
        }
        driver = driver1

Adding a log file as well:还要添加一个日志文件:

[Appium] Welcome to Appium v1.6.4
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"platformName":"Android","app":"locationApk.apk","deviceName":"emulator-5554","autoGrantPermissions":true},"capabilities":{"firstMatch":[{"platformName":"Android","app":"locationApk.apk","deviceName":"emulator-5554","autoGrantPermissions":true}]}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"platformName":"Android","app":locationApk.apk","deviceName":"emulator-5554","autoGrantPermissions":true},null,{"firstMatch":[{"platformName":"Android","app":locationApk.apk","deviceName":"emulator-5554","autoGrantPermissions":true}]},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1493796219386 (09:23:39 GMT+0200 (W. Europe Daylight Time))
[Appium] Creating new AndroidDriver (v1.17.1) session
[Appium] Capabilities:
[Appium]   platformName: 'Android'
[Appium]   app: locationApk.apk'
[Appium]   deviceName: 'emulator-5554'
[Appium]   autoGrantPermissions: true
[AndroidDriver] AndroidDriver version: 1.17.1
[BaseDriver] Session created with session id: dd34fa43-e463-489b-9e47-567f20c36c5d
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_131
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Android\sdk\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Using device: emulator-5554
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Android\sdk\platform-tools\adb.exe
[ADB] Setting device id to emulator-5554
[BaseDriver] Using local app 'locationApk.apk'
[AndroidDriver] Checking whether app is actually present
[AndroidDriver] Starting Android session
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","wait-for-device"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","echo","ping"]
[Logcat] Starting logcat capture
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","pm","list","packages","io.appium.settings"]
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","pm","list","packages","io.appium.settings"]
[ADB] App is installed
[ADB] Getting package info for io.appium.settings
[ADB] Getting connected devices...
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Android\sdk\build-tools\25.0.2\aapt.exe
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] Cannot read version codes of C:\Users\xxx\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk and/or io.appium.settings. Assuming correct app version is already installed
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.sdk"]
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","pm","dump","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[AndroidDriver] Pushing unlock helper app to device...
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","install","C:\\Users\\xxx\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-unlock\\bin\\unlock_apk-debug.apk"]
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","install","C:\\Users\\xxx\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-unlock\\bin\\unlock_apk-debug.apk"]
[ADB] Application 'C:\Users\xxx\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-unlock\bin\unlock_apk-debug.apk' already installed. Continuing.
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","appops","set","io.appium.settings","android:mock_location","allow"]
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","wm","size"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.model"]
[ADB] Current device property 'ro.product.model': Android SDK built for x86
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.manufacturer"]
[ADB] Current device property 'ro.product.manufacturer': unknown
[AndroidDriver] Parsing package and activity from app manifest
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Android\sdk\build-tools\25.0.2\aapt.exe
[ADB] Extracting package and launch activity from manifest
[ADB] badging package: nl.app.mobile
[ADB] badging act: nl.app.mobile.appMobile
[AndroidDriver] Parsed package and activity are: nl.app.mobile/nl.app.mobile.appMobile
[AndroidDriver] Remote apk path is /data/local/tmp/85f78b66b0710f626eacb402acfd93d2.apk
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","ls","/data/local/tmp/85f78b66b0710f626eacb402acfd93d2.apk"]
[AndroidDriver] Checking if app is installed
[ADB] Getting install status for nl.app.mobile
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","pm","list","packages","nl.app.mobile"]
[ADB] App is installed
[AndroidDriver] Apk is already on remote and installed, resetting
[AndroidDriver] Running fast reset (stop and clear)
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","nl.app.mobile"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","pm","clear","nl.app.mobile"]
[ADB] Device API level: 25
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Android\sdk\build-tools\25.0.2\aapt.exe
[ADB] Extracting package and launch activity from manifest
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","pm","dump","nl.app.mobile"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","nl.app.mobile","android.permission.ACCESS_FINE_LOCATION",";","pm","grant","nl.app.mobile","android.permission.WRITE_EXTERNAL_STORAGE",";","pm","grant","nl.app.mobile","android.permission.ACCESS_COARSE_LOCATION",";","pm","grant","nl.app.mobile","android.permission.RECORD_AUDIO",";","pm","grant","nl.app.mobile","android.permission.READ_PHONE_STATE",";","pm","grant","nl.app.mobile","android.permission.CAMERA",";","pm","grant","nl.app.mobile","android.permission.READ_EXTERNAL_STORAGE",";"]
[AndroidDriver] Extracting strings from apk locationApk.apk undefined C:\Users\xxx\AppData\Local\Temp\nl.app.mobile
[ADB] Extracting strings for language: default
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","persist.sys.locale"]
[ADB] Current device property 'persist.sys.locale': 
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.locale"]
[ADB] Current device property 'ro.product.locale': en-US
[ADB] No strings.xml for language 'en', getting default strings.xml
[ADB] Reading strings from converted strings.json
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","push","C:\\Users\\xxx\\AppData\\Local\\Temp\\nl.app.mobile\\strings.json","/data/local/tmp"]
[AndroidBootstrap] Watching for bootstrap disconnect
[ADB] Forwarding system: 4724 to device: 4724
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","forward","tcp:4724","tcp:4724"]
[UiAutomator] Starting UiAutomator
[UiAutomator] Moving to state 'starting'
[UiAutomator] Parsing uiautomator jar
[UiAutomator] Found jar name: 'AppiumBootstrap.jar'
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","push","C:\\Users\\xxx\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-android-bootstrap\\bootstrap\\bin\\AppiumBootstrap.jar","/data/local/tmp/"]
[ADB] Attempting to kill all uiautomator processes
[ADB] Getting all processes with uiautomator
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","ps"]
[ADB] No uiautomator process found to kill, continuing...
[UiAutomator] Starting UIAutomator
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","nl.app.mobile","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false]
[UiAutomator] Moving to state 'online'
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] json loading complete.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.
[AndroidBootstrap] Android bootstrap socket is now connected
[ADB] Getting connected devices...
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","window"]
[AndroidDriver] Screen already unlocked, doing nothing
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","am","start","-W","-n","nl.app.mobile/nl.app.mobile.appMobile","-S"]
[ADB] Waiting for pkg: 'nl.app.mobile' and activity: 'nl.app.mobile.appMobile' to be focused
[ADB] Possible activities, to be checked: nl.app.mobile.appMobile, nl.app.mobile.nl.app.mobile.appMobile
[ADB] Getting focused package and activity
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","window","windows"]
[ADB] Found package: 'nl.app.mobile' and fully qualified activity name : 'nl.app.mobile.appMobile'
[Appium] New AndroidDriver session created successfully, session dd34fa43-e463-489b-9e47-567f20c36c5d added to master session list
[BaseDriver] Event 'newSessionStarted' logged at 1493796234555 (09:23:54 GMT+0200 (W. Europe Daylight Time))
[MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","app":"locationApk.apk","deviceName":"emulator-5554","autoGrantPermissions":true},"platformName":"Android","app":"locationApk.apk","deviceName":"emulator-5554","autoGrantPermissions":true,"deviceUDID":"emulator-5554","platformVersion":"7.1.1","deviceScreenSize":"1080x1920","deviceModel":"Android SDK built for x86","deviceManufacturer":"unknown","appPackage":"nl.app.mobile","appWaitPackage":"nl.app.mobile","appActivity":"nl.app.mobile.appMobile","appWaitActivity":"nl.app.mobile.appMobile"}
[HTTP] <-- POST /wd/hub/session 200 15181 ms - 1018 
[HTTP] --> GET /wd/hub/session/dd34fa43-e463-489b-9e47-567f20c36c5d/contexts {}
[MJSONWP] Calling AppiumDriver.getContexts() with args: ["dd34fa43-e463-489b-9e47-567f20c36c5d"]
[AndroidDriver] Getting a list of available webviews
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","cat","/proc/net/unix"]
[AndroidDriver] Found webviews: []
[AndroidDriver] Available contexts: ["NATIVE_APP"]
[MJSONWP] Responding to client with driver.getContexts() result: ["NATIVE_APP"]
[HTTP] <-- GET /wd/hub/session/dd34fa43-e463-489b-9e47-567f20c36c5d/contexts 200 93 ms - 86 
[HTTP] --> POST /wd/hub/session/dd34fa43-e463-489b-9e47-567f20c36c5d/elements {"using":"xpath","value":"//*[contains(@id,'TutorialModeLogin')]"}
[MJSONWP] Calling AppiumDriver.findElements() with args: ["xpath","//*[contains(@id,'TutorialModeLogin')]","dd34fa43-e463-489b-9e47-567f20c36c5d"]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 0 ms for condition
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[contains(@id,'TutorialModeLogin')]","context":"","multiple":true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[contains(@id,'TutorialModeLogin')]","context":"","multiple":true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//*[contains(@id,'TutorialModeLogin')]' using 'XPATH' with the contextId: '' multiple: true
[HTTP] <-- POST /wd/hub/session/dd34fa43-e463-489b-9e47-567f20c36c5d/elements - - ms - - 
[HTTP] --> DELETE /wd/hub/session/dd34fa43-e463-489b-9e47-567f20c36c5d {}
[MJSONWP] Calling AppiumDriver.deleteSession() with args: ["dd34fa43-e463-489b-9e47-567f20c36c5d"]
[BaseDriver] Event 'quitSessionRequested' logged at 1493796309733 (09:25:09 GMT+0200 (W. Europe Daylight Time))
[AndroidDriver] Shutting down Android driver
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","nl.app.mobile"]
[ADB] Pressing the HOME button
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","input","keyevent",3]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//*[contains(@id,'TutorialModeLogin')]' using 'XPATH' with the contextId: '' multiple: true
[AndroidBootstrap] Sending command to android: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":[]}
[AndroidBootstrap] Received command result from bootstrap
[AndroidBootstrap] Received command result from bootstrap
[UiAutomator] Shutting down UiAutomator
[UiAutomator] Moving to state 'stopping'
[MJSONWP] Responding to client with driver.findElements() result: []
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[UiAutomator] UiAutomator shut down normally
[UiAutomator] Moving to state 'stopped'
[ADB] Attempting to kill all uiautomator processes
[ADB] Getting all processes with uiautomator
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","ps"]
[ADB] No uiautomator process found to kill, continuing...
[UiAutomator] Moving to state 'stopped'
[Logcat] Stopping logcat capture
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[Appium] Removing session dd34fa43-e463-489b-9e47-567f20c36c5d from our master session list
[BaseDriver] Event 'quitSessionFinished' logged at 1493796311072 (09:25:11 GMT+0200 (W. Europe Daylight Time))
[MJSONWP] Received response: null
[MJSONWP] But deleting session, so not returning
[MJSONWP] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/dd34fa43-e463-489b-9e47-567f20c36c5d 200 1340 ms - 76 
[BaseDriver] Shutting down because we waited 60 seconds for a command
[AndroidDriver] Shutting down Android driver
[Appium] Closing session, cause was 'New Command Timeout of 60 seconds expired. Try customizing the timeout using the 'newCommandTimeout' desired capability'
[Appium] Removing session dd34fa43-e463-489b-9e47-567f20c36c5d from our master session list
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.

Found the reason why it wasn't detecting the webview.找到它没有检测到 webview 的原因。 The app is build with phonegap and uses crosswalk.该应用程序使用 phonegap 构建并使用人行横道。 This causes the issue that Appium (under normal conditions) can't find a webview.这会导致 Appium(在正常情况下)找不到 webview 的问题。

Try printing all the available context.sometimes the spellings or case might be different.following is the psuedo code.尝试打印所有可用的上下文。有时拼写或大小写可能不同。以下是伪代码。

foreach(string context in contexts)
{
    print(context)
}

Also check whthwr you have webview debugging enabked in code.还要检查您是否在代码中启用了 webview 调试。

To do it use要做到这一点,请使用

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM