I'm facing a really annoying issue trying to atuomate one project site tests.
The tests goes through multiple pages filling some forms.
I have the following scenarios:
- I start the script, the chromedriver is opened and maximized. I keep my focus on the page while script runs. I go without problem through the whole test.
- I start the script, the chromedriver is opened and maximized. Now I put a window in front, but this window is not maximized, so I can see in background how the script is filling the forms but my widow focused is another one. I go without problem throught the whole test.
- I start the script, the chromedriver is opened and maximized. Now I put another window in front but this time the window is maximized and I can not see the script in background. Now I can go through some of the forms, but it gets stucked in one of them not being able to open some select boxes or writing text.
Things that I have checked/observed:
- I'm not able to think a logical reason of this happening. If I run the same 3 steps in firefox with geckdriver they always work.
- I have observed that when I switch from my window maximized on top, to chrome, I seem to find a gray page for some ms as it would be not rendered yet, I was able to make this screenshot by recording the screen:
Environment:
- I'm using perl with
Selenium::Chrome
together withChromeDriver 87.0.4280.20
- The site being tested is built on
JSF
and developers have not included any specfic focus requirement. - This ocurs always using the process described in step 3.
Hypothesis: Somehow chrome knows if is visible in screen and then its behaivour of elements loaded in DOM changes? I can still see find elements with selenium, but its behaivour on click does not work as expected.
Furthermore, in one of the steps where I was facing this issue, there was a button which would work with:
$driver->execute_script("arguments[0].click()", $element);
But not with
$element->click()