I am trying to get Selenium Android WebDriver to work with Rspec in order to test our Rails mobile app through the Android emulator.
I followed the instructions and passed the test with the following code:
driver = Selenium::WebDriver.for :android driver.navigate.to "http://google.com" element = driver.find_element(:name, 'q') element.send_keys "Hello WebDriver!" element.submit puts driver.title driver.quit
The WebDriver in the Android emulator runs the first two commands, but when it reaches element = driver.find_element(:name, 'q') , always with the error EOFError: end of file reached .
I found that the error occurs regardless of what follows the first navigate , so this is not like the find_element method.
For example, if I replaced the code above:
driver = Selenium::WebDriver.for :android driver.navigate.to "http://google.com" driver.navigate.to "http://stackoverflow.com" driver.quit
then I still get the same error in the second navigate command.
I tried to experiment with different timeouts, thinking that the problem is connectedness, but the end result is always the same. The first navigation command will work correctly, since the emulator will open google.com , but then nothing will happen.
Why am I getting this error? And how can I prevent this so that my tests can work?
source share