我的测试会传递除移动设备之外的所有设备,而click()
似乎失败了。我使用的是selenium webdriver,这是一个代码片段:
it('Expand when clicked', function (done: any) {
client
.waitForVisible('[pane-state-value="focused"] [pane-state-value="focused"] .smartimage-container-small', 15000)
.click('[pane-state-value="focused"] [pane-state-value="focused"] .smartimage-container-small')
.waitForVisible('body > .smartimage-container-large [fullscreen-image]', 15000)
.getElementSize('body > .smartimage-container-large [fullscreen-image]').then(function (fullscreenSize: any) {
client.getElementSize('body').then(function (bodySize: any) {
assert.equal(bodySize.width, fullscreenSize.width, 'fullscreen doesn\'t use full width');
assert.equal(bodySize.height, fullscreenSize.height, 'fullscreen doesn\'t use full height');
})
.call(done);
});
});
我看到一篇文章https://saucelabs.com/resources/articles/the-selenium-click-command,表示手机设备不支持点击命令,但我被告知这些测试之前已经通过,所以我想确保我不是遗漏的东西更明显。我尝试过调用doubleClick()
并在点击前添加暂停。点击功能执行但模拟的移动设备上没有任何反应。我还插入了手机并检查了开发工具,并确保选择器存在。