-
Notifications
You must be signed in to change notification settings - Fork 785
Description
Observed with
Python 3.13.0
SeleniumLibrary 6.7.1
Scenario
I have the following scenario in a test which fails sporadically:
- Link in an (internal) application is clicked which opens a different URL in a new tab
Switch Windowis called with the expected URL as locator and10 sas a timeout
Error
This works just fine most of the time, but occasionally I get the following error:
TypeError: cannot unpack non-iterable NoneType object
This error shows up pretty much instantly (within a few hundred ms), so the timeout is not taken into account.
However, in the associated screenshots, the expected page is always shown.
Analysis
I looked into the library's code and added some extra logging, which showed the error was coming from this line:
| id, name = self.driver.execute_script("return [ window.id, window.name ];") |
The call to self.driver.execute_script("return [ window.id, window.name ];") returns None, thus the assignment to the two variables fails with the above error.
Adding a 1 s sleep right before the call to execute_script makes the error no longer occur (even with many iterations of the test), so it does seem to be somehow timing related.
Questions
However I wasn't able to figure out what exactly causes this error. Do you have any idea what is the cause, or any guidance as to what additional things to log to better understand the issue?