Why not rollback to the previous version that you knew it worked and check?
Dusk suddenly can't find elements that need scrolling to access
I updated composer dependencies yesterday and since then am getting this error on several tests:
Facebook\WebDriver\Exception\UnknownServerException: unknown error: Element is not clickable at point (1450, 2309)
Test code:
$browser->visit(new EditPage()
->click('#add');
The element it is trying to access (#add) is simply down the page a bit. It is fully visible and if I pause the test before the click and manually scroll down, the test continues as normal. I'm not 100% sure if the update yesterday is related to the issue, but I can't think of anything else that may have caused this to happen so suddenly. Any body else experiencing this? Any ideas on how to fix it?
@zachleigh I came up with a few macros to make it a little cleaner. One to scroll to the bottom of the form and press the save button - This makes sure it is always visible and cleans up the test code. Because type won't work on checkboxes or radios, the other macro scrolls the browser to their position, so can be called in the test method chain to scroll them in to view before attempting to interact with them.
It works but I don't like needing to do this when we didn't before. I wonder if there is another factor at play as surely this must be effecting more people.
/**
* Scrolls page to the bottom and presses Save.
*/
Browser::macro('saveForm', function () {
$this->script('window.scrollTo(0,document.body.scrollHeight)');
$this->press('Save');
return $this;
});
/**
* Scrolls page to a specific element.
*
* Leaves a buffer at the top to account for a fixed header.
*/
Browser::macro('scrollTo', function ($id) {
$this->script("document.getElementById('$id').scrollIntoView()");
$this->script('window.scroll(0, window.scrollY - 50)');
return $this;
});
Please or to participate in this conversation.