Selenium IDE focus event does not fire if window is not activated

I added this code to my webpage:

<input id='argh' type='text' onfocus='this.value=7'>

If the browser window is not active, the focus event does not seem to fire (using the "focus" command) from Selenium:

# [info] Executing: |waitForElementPresent | argh | |
# [info] Executing: |focus | argh | |
# [info] Executing: |verifyValue | argh | 7 |
# [error] Actual value '' did not match '7'

This succeeds just fine if the window is displayed during testing. In addition, if I activate the browser window after the aforementioned failure, #argh is focused and fills with a seven, I return to Selenium and re-run the line, this succeeds. (Perhaps obviously, but ...)

What am I doing wrong? How can I check things like the AJAX drop-down menu from Selenium without a browser?

My setup is Selenium IDE 1.0.2 on Firefox 3.5.3 on win32.

+3
2

, fireEvent?

fireEvent | argh | focus
+4

-, Selenium. , Selenium , , , - , .

- , . . http://blog.mattheworiordan.com/post/9308775285/testing-focus-with-jquery-and-selenium-or .

, https://gist.github.com/1166821. JQuery $(': focus '), , .is(': focus '), , .

+1

Source: https://habr.com/ru/post/1719304/


All Articles