appium 1.4.16 for android无法识别WEB_VIEW上下文

时间:2015-12-15 17:46:36

标签: java android webview appium

我有一个webview的Android活动。

然而,appium 1.4.16无法识别这种情况。

我的Android设备是Android 4.2

myAndroidDriver.getContextHandles() ==>返回列表大小为1

我已经阅读了两个解决方案:

1)设置

setWebContentsDebuggingEnabled = true;

2)设置selendrium模式

a)“selendroid模式”的真正含义是什么? appium不使用UIAutomator?这会影响我的其他测试吗?

b)我之前尝试过这个,但代码执行失败了 当我添加:

capabilities.setCapability("automationName", "Selendroid");

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: hasInternetPermissionFromManifest failed. Error: Command failed: /bin/sh -c /Users/eladb/MyWorkspace/sdk/build-tools/android-4.4/aapt dump badging 
ERROR: no dump file specified
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3.54 seconds
Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44'
System info: host: 'eladb-macbookpro.roam.corp.google.com', ip: '100.105.45.192', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.2', java.version: '1.8.0_25'
Driver info: com.waze.mobileautomation.common.android.MyAndroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
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:242)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:141)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:160)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:168)

1 个答案:

答案 0 :(得分:0)

尝试:

driver.switchTo().window("WEBVIEW");

哪里的驱动程序是AndroidDriver,而您的CapabilityType.BROWSER_NAME设置为""(空)