Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium IDE focus event doesn't fire unless window is active

I added this code to my web page:

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

Unless the browser window is 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'

It succeeds just fine if the window is showing during testing. Furthermore, if I activate the browser window after the above failure, #argh is focused and fills with a seven, then I go back to Selenium and rerun the line, it succeeds. (Probably obvious, but...)

What am I doing wrong? How will I be able to test things like AJAX dropdown menus from Selenium without the browser showing?

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

like image 471
Kev Avatar asked Feb 20 '26 09:02

Kev


1 Answers

Does it make any difference if you use the fireEvent command?

fireEvent | argh | focus
like image 122
Dave Hunt Avatar answered Feb 22 '26 02:02

Dave Hunt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!