#37 楼 @skytraveler ,老的 chromedriver 确实是有很多 bug 和兼容性问题的,最好的办法还是找到高版本的原因,修改高版本的源码,得找高手来解决,😂
—— 来自 TesterHome 官方 安卓客户端
mac32 的试试呗
好的,多谢,记得之前只支持 Android,我主要是想解决 IOS 方面的问题,抽时间我也研究一下。
@yangchengtest ,请问楼主有没有解决截图慢的问题,我这边 IOS 也有时后会遇到截图太慢的情况,会超过 10 秒截图失败;虽然修改源码超时时间截图成功了,但是测试速度还是没解决。
请问楼主是如何解决的,我这边也有时后会遇到截图太慢的情况,会超过 10 秒截图失败;虽然修改源码超时时间截图成功了,但是测试速度还是没解决。
#3 楼 @chenhengjie123 ,多谢,是用的免费开发者账号,已开自动管理开发者账号,bundle id 只第一台手机打包时生成过,第二台没改了,好像之前还得次数多了,不让再改了,过几天失效了我再改一下试试
—— 来自 TesterHome 官方 安卓客户端
不差钱就买个,差钱的话你可以装个虚拟 mac,win 的配置稍微好点就行,加点内存,换个固态硬盘,也勉强可用
—— 来自 TesterHome 官方 安卓客户端
是只有 2.20 的才可以用吗?我之前也是只尝试降到 2.24,好坑啊,
@cherrycumtb ,@jake20001 遇到同样问题,解决了吗?
@xdf,帮忙看看以下错误:
环境:真机(iphone6,9.3.1),XCODE8.3,Team 使用的是 免费 Apple ID
xctest-client.js:173:14 [master] pid:11364 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:172:14 [master] pid:11364 2017-06-17 12:57:09.846 xcodebuild[11370:146237] Error Domain=IDETestOperationsObserverErrorDomain Code=4 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/stephen/Library/Developer/Xcode/DerivedData/XCTestWD-evljajykmolwzobrozpobiggeeea/Logs/Test/8E7EDF9F-68C7-427C-AFBE-5D89E33A9855/Session-XCTestWDUITests-2017-06-17_125642-UA1Njz.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/stephen/Library/Developer/Xcode/DerivedData/XCTestWD-evljajykmolwzobrozpobiggeeea/Logs/Test/8E7EDF9F-68C7-427C-AFBE-5D89E33A9855/Session-XCTestWDUITests-2017-06-17_125642-UA1Njz.log}xctest-client.js:173:14 [master] pid:11364 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:172:14 [master] pid:11364
Testing failed:
Command /bin/sh failed with exit code 162
** TEST FAILED **xctest-client.js:173:14 [master] pid:11364 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:172:14 [master] pid:11364
The following build commands failed:
PhaseScriptExecution Run\ Script /Users/stephen/Library/Developer/Xcode/DerivedData/XCTestWD-evljajykmolwzobrozpobiggeeea/Build/Intermediates/XCTestWD.build/Debug-iphoneos/XCTestWDUITests.build/Script-7F90C8321EF231B2003F2DA0.sh
(1 failure)xctest-client.js:173:14 [master] pid:11364 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:255:14 [master]
pid:11364 killing deviceLogProc pid: 11367
xctest-client.js:260:14 [master] pid:11364 killing runnerProc pid: 11370
xctest-client.js:266:14 [master] pid:11364 killing iproxyProc pid: 11369
xctest-client.js:183:14 [master] pid:11364 xctest client exit with code: 65, signal: null
xctest-client.js:211:14 [master] pid:11364 iproxy exit with code: null, signal: SIGKILL
xctest-client.js:145:16 [master] pid:11364 devicelog exit with code: null, signal: SIGKILL
xctest-client.js:247:14 [master] pid:11364 Fail to start xctest: undefined
undefined
iOS device started: 0bd62f77103bc32857f433ebc45e8c2e813d8a4a
inspector start at: http://192.168.0.114:5678
<-- GET /
helper.js:94:16 [master] pid:11364 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001
Error: connect ECONNREFUSED 127.0.0.1:8001
at Object.exports._errnoException (util.js:1016:11)
at exports._exceptionWithHostPort (util.js:1039:20)
at TCPConnectWrap.afterConnect as oncomplete
解决没?遇到了同样的问题,之前跑的好好的,开发给了一个新的 app 就这样了,安装 ios-webkit-debugger-proxy 后,虽然没报错了,但是 app 里面的 h5 页面元素仍获取不到
暂未找到解决方案,不知道内部的调用方式是怎样的,“chrome://inspect/#devices” 是可以读取到页面的,理论上 appium 应该也可以读取到的。不知道 chromedriver 端的日志是怎么查看的。
@weiqiliu ,我没有进行很深的研究,只是下载了一个旧版本的微信重装了,你可以尝试下载 老版本的 tbsSuite 试试
遇到同样的问题,之前还测试好好的,升级了一下微信和 appium 就这样了,降级也没救回来,感觉是微信那边调试工具的问题
—— 来自 TesterHome 官方 安卓客户端
楼主解决没?
刚开始做的话建议用新版本吧,解决了很多 bug,也加了一些新的功能。不过我们还是用的老的 1.4.0 的版本,感觉够用了,没有更新的必要
—— 来自 TesterHome 官方 安卓客户端
遇到同样的问题,楼主解决没?
用 Android Chrome 测试时最好是将 context 切换到"CHROMIUM"模式,然后用 click() 方法就可以了。
我刚才试了一下是可以的(C#):
((IContextAware)driver).Context = "CHROMIUM";
driver.FindElementByXPath("//*[text()='注册']").Click();
contains 是包含的意思,这样 ‘美团外卖’ 四个字前或末尾有图标或字符时也可以被找到
将下代码
ChromeOptions options = new ChromeOptions();
options.AddAdditionalCapability("androidProcess", "com.tencent.mm:tools");
capabilities.SetCapability(ChromeOptions.Capability, options);
替换为:
DesiredCapabilities option = new DesiredCapabilities();
option.SetCapability("androidProcess", "com.tencent.mm:tools");
capabilities.SetCapability(ChromeOptions.Capability, option.ToDictionary());
var contexts = ((IContextAware)driver).Contexts;
string webviewContext = null;
for (int i = 0; i < contexts.Count; i++)
{
Console.WriteLine(contexts[i]);
if (contexts[i].Contains("WEBVIEW"))
{
webviewContext = contexts[i];
break;
}
}
Assert.IsNotNull(webviewContext);
((IContextAware)driver).Context = webviewContext;
@all,谁知道 .net 应该怎么写,下面这样写切换不成功:
AndroidDriver<IWebElement> driver = null;
IWebElement element = null;
DesiredCapabilities capabilities = new DesiredCapabilities();
//capabilities.SetCapability("app", "");
capabilities.SetCapability("deviceName", "android emulator");
capabilities.SetCapability("browserName", "");
capabilities.SetCapability("platformName", "android");
capabilities.SetCapability("platformVersion", "7.0");//手机操作系统版本
capabilities.SetCapability("newCommandTimeout", "300"); ////设置命令超时时间,单位:秒。达到超时时间仍未接收到新的命令时 Appium 会假设客户端退出然后自动结束会话。
capabilities.SetCapability("unicodeKeyboard", "True");//使用 Unicode 输入法。默认值 false
capabilities.SetCapability("resetKeyboard", "True"); //在设定了 unicodeKeyboard 关键字的 Unicode 测试结束后,重置输入法到原有状态。如果单独使用,将会被忽略。默认值 false
capabilities.SetCapability("appPackage", "com.tencent.mm");
capabilities.SetCapability("appActivity", ".ui.LauncherUI");
capabilities.SetCapability("automationName", "appium");
capabilities.SetCapability("fastReset", "false");
capabilities.SetCapability("fullReset", "false");
capabilities.SetCapability("noReset", "true");
ChromeOptions options = new ChromeOptions();
options.AddAdditionalCapability("androidProcess", "com.tencent.mm:tools");
capabilities.SetCapability(ChromeOptions.Capability, options);
Uri serverUri = new Uri("http://127.0.0.1:4723/wd/hub");
try
{
//System.IO.File.AppendAllText("D:\\PageSources.xml",driver.PageSource);
driver = new AndroidDriver<IWebElement>(serverUri, capabilities, TimeSpan.FromSeconds(180));
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(1));
driver.FindElementByXPath("//*[@text='通讯录']").Click();
driver.FindElementByXPath("//*[@text='公众号']").Click();
driver.FindElementByAccessibilityId("搜索").Click();
driver.FindElementByXPath("//*[@text='搜索']").SendKeys("美");
driver.FindElementByXPath("//*[@text='美团']").Click();
driver.FindElementByXPath("//*[@text='吃喝玩乐']").Click();
driver.FindElementByXPath("//*[contains(@text,'附近优惠')]").Click();
Console.WriteLine(driver.Contexts);
Console.WriteLine(driver.PageSource);
var contexts = ((IContextAware)driver).Contexts;
string webviewContext = null;
for (int i = 0; i < contexts.Count; i++)
{
Console.WriteLine(contexts[i]);
if (contexts[i].Contains("WEBVIEW"))
{
webviewContext = contexts[i];
break;
}
}
Assert.IsNotNull(webviewContext);
((IContextAware)driver).Context = webviewContext;
Thread.Sleep(3000);
driver.Quit();
}
catch (Exception)
{
if (driver != null)
{
driver.Quit();
}
}
报错信息:
[2017-03-22 12:15:38][AndroidDriver] Connecting to chrome-backed webview context 'WEBVIEW_com.tencent.mm:tools'
[2017-03-22 12:15:38][AndroidDriver] A port was not given, using random port: 8000
[2017-03-22 12:15:38][Chromedriver] Changed state to 'starting'
[2017-03-22 12:15:38][Chromedriver] Set chromedriver binary as: C:\Users\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
[2017-03-22 12:15:38][Chromedriver] Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (netstat -nao ^| findstr /R /C:"8000 "
) do (FOR /F "usebackq" %b in (TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe
) do (IF NOT %b=="" TASKKILL /F /PID %a))
[2017-03-22 12:15:38][Chromedriver] No old chromedrivers seemed to exist
[2017-03-22 12:15:38][Chromedriver] Spawning chromedriver with: C:\Users\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=8000 --adb-port=5037
[2017-03-22 12:15:38][Chromedriver] [STDOUT] Starting ChromeDriver 2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30) on port 8000
Only local connections are allowed.
[2017-03-22 12:15:38][JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body
[2017-03-22 12:15:38][JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"10.0.10240\"}}}"
[2017-03-22 12:15:38][JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"BinaryLocation":null,"LeaveBrowserRunning":false,"Proxy":null,"Arguments":[],"Extensions":[],"DebuggerAddress":null,"MinidumpPath":null,"PerformanceLoggingPreferences":null,"androidDeviceSerial":"APU7N16309003842"}}}
[2017-03-22 12:15:38][JSONWP Proxy] Got response with status 200: {"sessionId":"1cf680ec27eb7ed6a73be8c1e88c798c","status":13,"value":{"message":"unknown error: cannot parse capability: chromeOptions\nfrom unknown error: unrecognized chrome option: Arguments\n (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)"}}
[2017-03-22 12:15:38][JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"BinaryLocation":null,"LeaveBrowserRunning":false,"Proxy":null,"Arguments":[],"Extensions":[],"DebuggerAddress":null,"MinidumpPath":null,"PerformanceLoggingPreferences":null,"androidDeviceSerial":"APU7N16309003842"}}}
[2017-03-22 12:15:38][JSONWP Proxy] Got response with status 200: {"sessionId":"157d64dd57fef1ceb42aca0f3c6282dd","status":13,"value":{"message":"unknown error: cannot parse capability: chromeOptions\nfrom unknown error: unrecognized chrome option: Arguments\n (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)"}}
[2017-03-22 12:15:38][JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"BinaryLocation":null,"LeaveBrowserRunning":false,"Proxy":null,"Arguments":[],"Extensions":[],"DebuggerAddress":null,"MinidumpPath":null,"PerformanceLoggingPreferences":null,"androidDeviceSerial":"APU7N16309003842"}}}
[2017-03-22 12:15:38][JSONWP Proxy] Got response with status 200: {"sessionId":"f2b4c509ad0b66b50e6204cda6949705","status":13,"value":{"message":"unknown error: cannot parse capability: chromeOptions\nfrom unknown error: unrecognized chrome option: Arguments\n (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)"}}
[2017-03-22 12:15:38][JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"BinaryLocation":null,"LeaveBrowserRunning":false,"Proxy":null,"Arguments":[],"Extensions":[],"DebuggerAddress":null,"MinidumpPath":null,"PerformanceLoggingPreferences":null,"androidDeviceSerial":"APU7N16309003842"}}}
[2017-03-22 12:15:38][JSONWP Proxy] Got response with status 200: {"sessionId":"2bebd54f4a175642d051bbafee2d7a5f","status":13,"value":{"message":"unknown error: cannot parse capability: chromeOptions\nfrom unknown error: unrecognized chrome option: Arguments\n (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)"}}
[2017-03-22 12:15:38][Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM
[2017-03-22 12:15:38][Chromedriver] Changed state to 'stopped'
[2017-03-22 12:15:38][Chromedriver] Error: unknown error: cannot parse capability: chromeOptions
from unknown error: unrecognized chrome option: Arguments
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)
at Chromedriver.callee$2$0$ (C:\Users\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\lib\chromedriver.js:176:15)
at tryCatch (C:\Users\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\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\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\node_modules\babel-runtime\regenerator\runtime.js:136:37)
Error: unknown error: cannot parse capability: chromeOptions
from unknown error: unrecognized chrome option: Arguments
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)
at Chromedriver.callee$2$0$ (C:\Users\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\lib\chromedriver.js:176:15)
at tryCatch (C:\Users\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\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\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[2017-03-22 12:15:38][MJSONWP] Encountered internal error running command: Error: unknown error: cannot parse capability: chromeOptions
from unknown error: unrecognized chrome option: Arguments
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)
at Chromedriver.callee$2$0$ (C:\Users\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\lib\chromedriver.js:176:15)
at tryCatch (C:\Users\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\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\stephen\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium-chromedriver\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[2017-03-22 12:15:38][HTTP] <-- POST /wd/hub/session/1f06a81d-0a2e-4840-a4da-b800c9c7e26e/context 500 1441 ms - 407
非常感谢楼主的分享,受益匪浅,我也曾想过这个问题,一直没想清楚。另外就同一个公司而言,不同的测试人员设计出来的测试用例也是差别很大的,很多时候组长审核时也比较难把握,到底哪些人设计的更合理呢,如何培养他们去设计,根据不同的项目或业务又改采用什么样的设计策略也值得我们深思~
—— 来自 TesterHome 官方 安卓客户端
赞,学习啦~
—— 来自 TesterHome 官方 安卓客户端
不同分辨率的手机需要分别截图吗?比如我在 iPhone5S 上截得图能测 iPhone6 吗?
—— 来自 TesterHome 官方 安卓客户端