0

So I want to run some Selendroid tests. I run

java -jar selendroid-standalone-0.17.0-with-dependencies.jar -aut app-debug.apk

Selendroid says:

selendroid-standalone server has been started on port: 4444

Next I run this Python program:

import unittest
from selenium import webdriver


class FindElementTest(unittest.TestCase):

    def setUp(self):
        desired_capabilities = {'aut': 'as.corbin.testapp:1.0'}

        self.driver = webdriver.Remote(
            desired_capabilities=desired_capabilities
        )
        self.driver.implicitly_wait(30)


    def test_find_element_by_id(self):
        self.driver.get('and-activity://as.corbin.testapp.MainActivity')
        self.assertTrue("and-activity://MainActivity" in self.driver.current_url)
        my_text_field = self.driver.find_element_by_id('myid')
        my_text_field.send_keys('Hello Selendroid')

        self.assertTrue('Hello Selendroid' in my_text_field.text)

    def tearDown(self):
        self.driver.quit()

if __name__ == '__main__':
    unittest.main()

The output of Selendroid is:

INFORMATION: Retrying request to {}->http://localhost:8080 Dez 10, 2015 8:42:38 AM org.apache.http.impl.client.DefaultHttpClient tryExecute

INFORMATION: I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:8080: Connection reset Dez 10, 2015 8:42:38 AM org.apache.http.impl.client.DefaultHttpClient tryExecute INFORMATION: Retrying request to {}->http://localhost:8080 Dez 10, 2015 8:42:38 AM io.selendroid.android.impl.AbstractDevice isSelendroidRunning

SCHWERWIEGEND: Error getting status: java.net.SocketException: Connection reset Dez 10, 2015 8:42:38 AM io.selendroid.server.handler.CreateSessionHandler handle SCHWERWIEGEND: Error while creating new session: Selendroid server on the device didn't came up after 20sec:

What service does Selendroid try to connect to here? The jar name says 'standalone', the instructions only mention to start this jar.

What am I missing?

e4c5
  • 52,766
  • 11
  • 101
  • 134
fweigl
  • 21,278
  • 20
  • 114
  • 205

1 Answers1

0

The answer is that this is a red herring, your tests will run in spite of this error. Sometimes you will see that the port number keeps changing as well. For example, I just ran a set of tests using python-selenium and the error quitely changed to

INFO: I/O exception (java.net.SocketException) 
   caught when processing request to {}->http://localhost:8081: Connection reset
Jun 08, 2016 12:55:58 PM org.apache.http.impl.execchain.RetryExec execute

but my tests executed.

For those who land here from google due to their tests not running due to some inexplicable reason (and the only error is the one above). Please note that if you install your app on the device outside of selenium it may not be testable. Please uninstall it

adb uninstall my.app.name

And then restart selenium before carrying out your tests.

e4c5
  • 52,766
  • 11
  • 101
  • 134