Reputation: 21
I am using Protractor for automation. There is a page in an application where there is one web element button
which Protractor can not find while execution. That web element is present in DOM but it is not visible on screen. Protractor is able to find & click the element only when we scroll down in application. But this is not a good approach as every time I have to place the code of page_Down.
Any help here ?
Upvotes: 0
Views: 5719
Reputation: 4832
You can simply use ele.scrollIntoView(true)
method to make an element visible in view port.
var button = element(by.buttonText("Login"));
browser.executeScript("arguments[0].scrollIntoView(true)",button.getWebELement()):
browser.wait(EC.elementToBeClickable(button),5000);
button.click();
Here you find the JavaScript definition of scrollIntoView()
Upvotes: 3