A situation has arisen while testing my Ionic app.
On a particular page, the button that needs to be clicked is located outside the window boundaries. As a result, the code snippet below produces an error:
element.all(by.css('.item.item-complex')).get(9).click();
The error message reads:
ElementNotVisibleError: element not visible
To address this issue, my approach is to scroll down the page in order to bring the button into view before attempting to simulate a click on it. Here is the code snippet I am using:
browser.executeScript('window.scrollTo(0, 200);').then(function() {
element.all(by.css('.item.item-complex')).get(9).click();
expect(browser.getTitle()).toEqual('Vegeta The Prince');
});
Despite adopting this strategy, the scrolling action does not seem to be taking place as intended. I am seeking assistance in resolving this issue.
For context, I am utilizing Google Chrome for this task.