Reputation: 872
I am trying to configure Robot Framework to open Chrome Browser in an android emulator. I have this code to do that:
*** Settings ***
Suite Setup Set Library Search Order SeleniumLibrary
Test Setup Open page
Test Teardown Close Page
Library SeleniumLibrary
Library Collections
Library requests
Library AppiumLibrary
*** Test Cases ***
Test_case_sample
Go To https://www.google.com
Sleep 10s
*** Keywords ***
Open Page
${desired_capabilities}= Create Dictionary
Set to Dictionary ${desired_capabilities} deviceName Demo_6_Inch
# Set to Dictionary ${desired_capabilities} build test_run
Set to Dictionary ${desired_capabilities} platformName Android
Set to Dictionary ${desired_capabilities} name test_case_Sample
Set to Dictionary ${desired_capabilities} platformVersion 8.0
Set to Dictionary ${desired_capabilities} deviceOrientation portrait
Set to Dictionary ${desired_capabilities} browserName Chrome
Set to Dictionary ${desired_capabilities} appiumVersion 1.7.1
Set to Dictionary ${desired_capabilities} deviceType phone
Create Webdriver Remote desired_capabilities=${desired_capabilities}
Close Page
Close All Applications
When running the script, I get the following error :
11:10:39.547 INFO Creating an instance of the Remote WebDriver.
11:10:40.548 INFO Could not connect to port 4444 on host 127.0.0.1
11:10:40.548 INFO Could not get IP address for host: 127.0.0.1
11:10:41.561 FAIL URLError: urlopen error [Errno 10061] No connection could be made because the target machine actively refused it
I than started an instance of selenium webdriver at localhost:4444 . But this time I got this error:
WebDriverException: Message: Error forwarding the new session Empty pool of VM for setup Capabilities {appiumVersion: 1.7.1, browserName: Chrome, deviceName: Demo_6_Inch, deviceOrientation: portrait, deviceType: phone, name: test_case_Sample, platformName: android, platformVersion: 8.0} Stacktrace: at org.openqa.grid.web.servlet.handler.RequestHandler.process (RequestHandler.java:117) at org.openqa.grid.web.servlet.DriverServlet.process (DriverServlet.java:84) at org.openqa.grid.web.servlet.DriverServlet.doPost (DriverServlet.java:68) at javax.servlet.http.HttpServlet.service (HttpServlet.java:707) at javax.servlet.http.HttpServlet.service (HttpServlet.java:790) at org.seleniumhq.jetty9.servlet.ServletHolder.handle (ServletHolder.java:841) at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle (ServletHandler.java:535) at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:188) at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle (Sessio... [ Message content over the limit has been removed. ] at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope (ContextHandler.java:1155) at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle (ScopedHandler.java:141) at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132) at org.seleniumhq.jetty9.server.Server.handle (Server.java:561) at org.seleniumhq.jetty9.server.HttpChannel.handle (HttpChannel.java:334) at org.seleniumhq.jetty9.server.HttpConnection.onFillable (HttpConnection.java:251) at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded (AbstractConnection.java:279) at org.seleniumhq.jetty9.io.FillInterest.fillable (FillInterest.java:104) at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run (ChannelEndPoint.java:124) at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:679) at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:597)
at java.lang.Thread.run (:-1)
How can I overcome this and run the emulator?
Thanks for your suggestion to solve this
Upvotes: 0
Views: 2864
Reputation: 872
Finally found the simple solution :
*** Settings ***
Library SeleniumLibrary
Library Collections
*** Variables ***
*** Test Cases ***
AndroidConnection
${Options} Create Dictionary androidPackage com.android.chrome
${caps} Create Dictionary chromeOptions ${Options}
Set to Dictionary ${caps} platformName Android
Set to Dictionary ${caps} platformVersion 8.0
Set To Dictionary ${caps} deviceName emulator-5554
Set To Dictionary ${caps} browserName Chrome
Create Webdriver Remote command_executor=http://localhost:4723/wd/hub desired_capabilities=${caps}
go to http://www.google.com
Close Browser
Upvotes: 3