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.
I have tackled this issue by scrollingto the button element using javascript:
await browser.executeScript(‘arguments[0].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?
Source: Read More