How to bring elements to view automatically in Protractor or selenium
jeanid last edited by
I have a webpage to be tested which has a button at the footer of the page. When i click it, there should be an error message shown near to it.
I was successful in automating this scenario but the issues that , page view does not scroll automatically to page footer. So, on test failures the screenshot i get does not have footer region of the page and thus cannot tell why the test failed.
await browser.executeScript('arguments.scrollIntoView()', element);
But moving to each element in my test suite through a custom script does not look advisable.
Is there a better way to automatically scroll to the element with which the webdriver api is interacting?
For instance , if i click the button then the browser scrolls automatically to page footer and if i again click the title of page, then the browser scrolls back to top?
This is what the
Actionsclass is for, there is a "moveToElement()" function in each implementation. This is more or less how it will look like in Protractor: