@chen_sen 楼主你好,我是按照你的代码执行的
但是最后报告统计的时候,会吧 test 都统计了,有些重复,怎么可以不统计 test 呢
你好,想问下,获取手机验证码,我手机需要 root 吗?我现在不知道在哪个文件里
嗯,这个是可以了
但是还有很多方法都不能显示
比如:
是怎么回事呢?
请教一下
使用@Description 这个方法,为什么在报告里不显示呢,是哪里配置不对吗?
可以了,谢谢
driver 为 20,用真机很不稳定
可以了,降到 2.20,但是进入小程序后,从 app 切换到 webview 的时候要等一段时间,你们也是吗?
我的 appium 已经安装完了,服务可以正常启动,但是怎么不显示?是需要配置环境变量吗?
好,加我 Q 吧 85135506
这个我倒是没有试,周一我执行的时候就出现这个错误了,我以为是我上周运行 monkey 导致的,之后换了一台真机还是不行,又觉得是 PC 机器环境有问题,还重新装了系统,结果还是不行,之后算是放弃了,还是回到模拟器上了,目前看模拟器执行都正常,要是真机有解决办法我还是会切换回真机的,就等着谁有解决方案了
请问你也是用的真机吧?我这是用的真机,也是上周好好的,周一来的时候就不行了,目前我用真机不行,之后我试了用模拟器倒是可以的,只不过不是进入 WEBVIEW_com.tencent.mm:tools 了
那你这个问题解决了吗?
请教各位大侠,我测微信小程序的时候,切换 webview 报错
基本设置:
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("androidProcess", "com.tencent.mm:appbrand0");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
当代码执行到这里就报错了:
driver.context("WEBVIEW_com.tencent.mm:tools");
控制台日志:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: session not created exception: please close '' and try again
(Driver info: chromedriver=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 4.98 seconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'YK-DZ-4711702', ip: '172.168.16.110', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{appPackage=com.tencent.mm, noReset=true, deviceName=05157df5a207d11f, fullReset=false, platform=LINUX, deviceUDID=05157df5a207d11f, desired={appPackage=com.tencent.mm, noReset=true, deviceName=05157df5a207d11f, fullReset=false, appActivity=.ui.LauncherUI, platformVersion=6.0.1, browserName=, fastReset=false, unicodeKeyboard=true, chromeOptions={args=[], extensions=[], androidProcess=com.tencent.mm:appbrand0}, udid=05157df5a207d11f, platformName=Android, resetKeyboard=true}, platformVersion=6.0.1, webStorageEnabled=false, takesScreenshot=true, browserName=, javascriptEnabled=true, unicodeKeyboard=true, udid=05157df5a207d11f, platformName=Android, deviceManufacturer=samsung, resetKeyboard=true, deviceScreenSize=1440x2560, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, appActivity=.ui.LauncherUI, locationContextEnabled=false, deviceModel=SM-G9208, fastReset=false, chromeOptions={args=[], extensions=[], androidProcess=com.tencent.mm:appbrand0}}]
Session ID: a9c2ce80-0091-43d1-8c71-73ac8e955e02
appium 日志:
[Chromedriver] Error: session not created exception: please close '' and try aga
in
(Driver info: chromedriver=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9
cf),platform=Windows NT 6.1.7601 SP1 x86_64)
at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:176:15)
at tryCatch (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\
node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (C:\Users\Administrator\AppData\Roaming
\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:3
7)
Error: session not created exception: please close '' and try again
(Driver info: chromedriver=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9
cf),platform=Windows NT 6.1.7601 SP1 x86_64)
at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:176:15)
at tryCatch (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\
node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (C:\Users\Administrator\AppData\Roaming
\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:3
7)
[MJSONWP] Encountered internal error running command: Error: session not created
exception: please close '' and try again
(Driver info: chromedriver=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9
cf),platform=Windows NT 6.1.7601 SP1 x86_64)
at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:176:15)
at tryCatch (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\
node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (C:\Users\Administrator\AppData\Roaming
\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:3
7)
[HTTP] <-- POST /wd/hub/session/a9c2ce80-0091-43d1-8c71-73ac8e955e02/context 500
4980 ms - 357
请问是怎么回事呢?
我也遇到了这个问题,可以切换到 webview,但是获取页面源码不是想要的, 要是你们有解决了,麻烦共享下,谢谢!
请教下,已经切换到 webview,但是找不到元素,是怎么回事啊,谢谢
package com.demo;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.NoSuchContextException;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AndroidMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import java.io.File;
import java.net.URL;
import java.util.Set;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.annotations.Test;
public class Demo {
@Test
public static void startapp() throws Exception{
AppiumDriver driver;
DesiredCapabilities capabilities=new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "127.0.0.1:21503");
// capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "192.168.154.101:5555");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.1.1");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
//启动应用的包名
capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.tencent.mm");
//启动应用的起始 ACTIVITY
capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY,".ui.LauncherUI");
//支持中文输入
capabilities.setCapability("unicodeKeyboard", "True");
//重置输入法为系统默认
capabilities.setCapability("resetKeyboard", "True");
ChromeOptions options = new ChromeOptions();
// options.setExperimentalOption("androidProcess", "com.tencent.mm:tools");
options.setExperimentalOption("androidProcess", "com.tencent.mm:appbrand0");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
// DesiredCapabilities option = new DesiredCapabilities();
// option.setCapability("androidProcess", "com.tencent.mm:appbrand0");
// capabilities.setCapability(ChromeOptions.CAPABILITY, option);
driver=new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
Thread.sleep(5000);
System.out.println("启动 app 成功");
Thread.sleep(5000);
driver.findElementByXPath("//[@text='发现']").click();
driver.findElementByXPath("//[@text='小程序']").click();
Thread.sleep(2000);
// driver.findElementByXPath("//*[contains(@text, '京东购物')]").click();
// Thread.sleep(5000);
//
// try{
// Set contexts = driver.getContextHandles();
// for (String context : contexts) {
// //打印出来看看有哪些 context
// System.out.println(context);
// }
// driver.context("WEBVIEW_com.tencent.mm:appbrand0");
// }catch(NoSuchContextException nce){
// Assert.fail("没有这个 context:");
// }
// Thread.sleep(5000);
// driver.findElementByXPath("//span[contains(text(), '领优惠券')]").click();
// ---------------------------------------------------------------------------------------
driver.findElementByXPath("//*[contains(@text, '美团外卖')]").click();
Thread.sleep(5000);
try{
Set contexts = driver.getContextHandles();
for (String context : contexts) {
//打印出来看看有哪些 context
System.out.println(context);
}
driver.context("WEBVIEW_com.tencent.mm:appbrand0");
}catch(NoSuchContextException nce){
Assert.fail("没有这个 context:");
}
Thread.sleep(5000);
driver.findElementByXPath("//[contains(@url, '美食')]").click();
driver.findElementByXPath("//[contains(., '金百万')]").click();
Thread.sleep(2000);
driver.quit();
}
}