楼主,edsion 分享的链接我打不开,你能发一个给我么,谢谢了!渣渣弱弱问一句,是把这个 js 文件放到\go\src\github.com\google\battery-historian\compiled 目录下吗
我使用的 appium 是 v1.8.1 的
appium-desktop v1.8.1
java-client-5.0.0
selenium-server-standalone-3.8.1
小白想请教一下,为什么需要用到这段代码切换到小程序的 contexts 和当前 handles 吖。我切的时候报错了,不切直接继续写脚本操作小程序,反而没有问题,所以可以直接不切吗。
Set contexts = driver.getContextHandles();
for(String s : contexts) {
System.out.println("当前 contexts:"+s);
}
driver.context("WEBVIEW_com.tencent.mm:toolsmp");
Set windowsHandles=driver.getWindowHandles();
for(String s : windowsHandles) {
System.out.println("当前 Handles:"+s);
driver.switchTo().window(s);
Thread.sleep(2000);
}
谢谢了!手动配置为空后确实不会报错了 (o゚▽゚) o
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: The desired should not include both of an 'appPackage' and a 'browserName'
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'BAC1600674', ip: '30.39.52.46', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_181'
Driver info: driver.version: AndroidDriver
楼主,我加上这 3 行,就会报如上的错误,是因为 selenium 的版本问题吗
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("androidProcess", "com.tencent.mm:appbrand1");
capability.setCapability(ChromeOptions.CAPABILITY, options);