clicks do not work in nightwatch.js

帅比萌擦擦* 提交于 2019-12-11 11:41:04

问题


Sometimes clicks do not work in Firefox or Chrome when I am using nightwatch. I have the following code

browser
.waitForElementVisible('.example')
.click('.example')
.waitForElementVisible('body')

The problem is the click event doesn't fire. Does anyone know why clicks sometimes do not work when using nightwatch.js and what you should do to accomodate this?


回答1:


I guess, you should specify the time period in the function waitForElementVisible('body', 1000). Update the code with this and see you are able to resolve the issue

For syntax and example for waitElementVisible() see here




回答2:


I was looking for an answer to this as well and the only solution seems to be to use an older version of Firefox and a compatible driver.

Here is the message that Selenium offers when you attempt to create a new issue on their github issue tracker:

"Since Firefox version 48, Mozilla requires all add-ons to be signed. Until recently, Firefox support in Selenium was exclusively provided by an add-on. As this add-on is not currently signed, this solution does not work with the latest Firefox releases. As an alternative, Mozilla are working on a WebDriver specification compliant implementation named GeckoDriver. Please note that the specification is not complete, and that Selenium itself does not comply with the specification at this time. This means that features previously available through Selenium will not be available using GeckoDriver."




回答3:


.waitForElementVisible('.example')

waitForElemenVisible accepts a minimum of 3 arguments. Please see the following snippet for an example of the correct usage

.waitForElementVisible('.example',5000,false)


来源:https://stackoverflow.com/questions/36096113/clicks-do-not-work-in-nightwatch-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!