在Android上运行测试时遇到问题。看起来像点击操作不起作用,但在iPhone和桌面上的Chrome(Windows)中工作正常。 我使用 CodeceptJS 1.1.0 , WebDriverIO 4.9.9 , Selenium-stanalone 6.11.0 和 BrowserStack 1.5.0
BrowserStack配置:
exports.config = {
tests: ******,
timeout: 10000,
output: './output',
helpers: {
WebDriverIO: {
user: ******,
key: ******,
url: ******,
smartWait: 5000,
browser: 'Android',
commonCapabilities: [{
'browserstack.debug': true,
'browserstack.video': false
}],
},
MyHelper: {
require: "./MyHelper.js"
}
},
include: {
I: './hosts/helper.js'
},
bootstrap: false,
mocha: {},
name: 'js'
};
iPhone日志:
• I am on page "/"
• I see element "#registerMultiStepContainer"
• I see element "#registration-step-1 .next"
• I click "#registration-step-1 .next"
WARNING: the "touchClick" command will be deprecated soon. If you have further questions, reach out in the WebdriverIO Gitter support channel (https://gitter.im/webdriverio/webdriverio).
Note: This command is not part of the W3C WebDriver spec and won't be supported in future versions of the driver. It is recommended to use the touchAction command for this.
(You can disable this warning by setting `"deprecationWarnings": false` in your WebdriverIO config)
• I wait 5
• I see element "#registration-step-2"
✓ OK in 15109ms
Android日志:
• I am on page "/"
• I see element "#registerMultiStepContainer"
• I see element "#registration-step-1 .next"
• I click "#registration-step-1 .next"
WARNING: the "touchClick" command will be deprecated soon. If you have further questions, reach out in the WebdriverIO Gitter support channel (https://gitter.im/webdriverio/webdriverio).
Note: This command is not part of the W3C WebDriver spec and won't be supported in future versions of the driver. It is recommended to use the touchAction command for this.
(You can disable this warning by setting `"deprecationWarnings": false` in your WebdriverIO config)
• I wait 5
• I see element "#registration-step-2"
✖ FAILED in 17435ms
-- FAILURES:
1) Login test: Login as testuser:
expected elements of #registration-step-2 to be seen
+ expected - actual
-false
+true
我尝试使用自定义步骤替代click
,而不是使用Webdriver touchClick
,而是使用其他内容,但后来我得到了:
Not yet implemented. Please help us: http://appium.io/get-involved.html
有人可以向我提供任何可能存在问题的信息以及Webdriver
和Appium
之间的问题是什么?
修改
测试代码:
I.amOnPage('/');
I.seeElement('#registerMultiStepContainer');
I.seeElement('#registration-step-1 .next');
I.wait(5); // working same with and without this step
I.click('#registration-step-1 .next');
I.wait(5);
I.seeElement('#registration-step-2');
我的自定义步骤:
tap(selector) {
let browser = this.helpers['WebDriverIO'].browser;
return browser.touchPerform([{
action: 'tap',
options: {
element: selector,
x: 5,
y: 5,
count: 1
}
}]);
}
也尝试这个和类似的:
tap(selector) {
return this.helpers['WebDriverIO'].browser.touchAction(selector, 'tap');
}
答案 0 :(得分:2)
我仍然不知道问题是什么,Selenium / Webdriver / Browserstack不兼容或设置错误或者是Browserstack上的一些错误,但我在自定义步骤中使用模拟点击事件修复此问题。
如果有人有更好的方法,请告诉我。感谢。
if(3==argc)
make_board(argv[1], argv[2]);
else if(1==argc)
make_board("10", "10");
else
{
/*error*/
}