I have an app which includes a button that you click which scrolls the page using JS.
I get a "Element is not clickable at point (somepoint,somepoint)" error, I think this is because selenium/protractor isn't aware of the dynamic scroll and so isn't waiting for it, how can I set a specific time to wait before attempting the next action?
You can use protractor expected conditions like
var EC = protractor.ExpectedConditions;
buttonThatScrolls.click();
var nextElement = $('#xyz'));
browser.wait(EC.presenceOf(nextElement), 10000);
nextElement.click();
You may also need to move to element before clicking:
browser.actions.mouseMove(elm).perform();
browser.executeScript("arguments[0].scrollIntoView();", elm);
Note that there is a hacky workaround - click the element via javascript :
browser.executeScript("arguments[0].click();", elm);
which may work as is, but make sure you know the difference:
And, to add to the @nilesh's answer, elementToBeClickable
expected condition sounds like a better fit in this particular case:
browser.wait(EC.elementToBeClickable(elm), 5000);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.