Switch Window sporadically fails with TypeError
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- testing-qa
Línea de trabajo
Comienza en src/SeleniumLibrary/locators/windowmanager.py, en la línea que desempaqueta el resultado de execute_script("return [ window.id, window.name ];"). Reproduce el escenario de Switch Window con una nueva pestaña abierta con retraso e inspecciona el manejo de excepciones existente y el flujo de timeout. Se considera completado cuando el TypeError intermitente está solucionado sin romper el cambio de ventana ni el comportamiento de timeout solicitado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
Expected behaviour
The new window is switched to. If the window is not immediately available/ready when this keyword is started, it should wait until the window can be switched to, within the given timeout limits.
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:
https://github.com/robotframework/SeleniumLibrary/blob/ce9d0ec510bd99c5a1b1cd114f767c7feeae1208/src/SeleniumLibrary/locators/windowmanager.py#L199
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.
I guess there's a short timeframe where the window is there but not fully ready and this makes the function call fail? But I wasn't able to understand the exact nature of this presumed 'not ready' state so far.
Proposed solution
The TypeError could be added to the already present except, which successfully avoided failures due to this in my scenario.
Adding this would be trivial, but I'm not sure about the implications:
- does anything depend on the current behaviour that raises an error in this case (seems not, but I'm not super familiar with the library's codebase)?
- would it be appropriate to suppress this error in the library, given it is not fully understood what exactly the nature of the actual, underlying error is?
Do you have any guidance how to proceed here?
- Lenguaje dominante
- Python
- Estrellas
- 1.5k
- Forks
- 787
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de robotframework/SeleniumLibrary
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
robotframework/SeleniumLibrary#1941 · 3 comentarios ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
robotframework/SeleniumLibrary#1833 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
robotframework/SeleniumLibrary#1436 · 5 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
robotframework/SeleniumLibrary#1993 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
robotframework/SeleniumLibrary#1992 · 4 comentarios ·
Todos los issues de robotframework/SeleniumLibrary
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
zostera/django-bootstrap4#894 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
use-agent-os/agent-os#3276 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
NousResearch/hermes-agent#117848 ·