0

I try open chrome browser in my android, using robotframework with this script

*** Settings ***
Documentation     A resource for global
Library           Selenium2Library      timeout=15


*** Variable ***
${COMMAND_EXECUTOR}   http://localhost:4723/wd/hub
${BROWSER}            Chrome
${PLATFORM_NAME}      Android
${UDID}               FF786D96CB71039D

*** Test Case ***
Test Case Open Chrome In Real Device
  Open Android Browser        https://www.google.co.id

*** Keywords ***
Open Android Browser
  [Documentation]     To open android default browser (not chrome) and go to provided URL
  [Arguments]         ${url}
  ${capabilities}=    Create Dictionary   browserName=${BROWSER}    platformName=${PLATFORM_NAME} udid=${UDID}   deviceName=${PLATFORM_NAME}
  Create Webdriver    Remote  command_executor=${COMMAND_EXECUTOR}    desired_capabilities=${capabilities}
  Go To               ${url}

The problem is when i try to run it, get an error

==============================================================================
Testcase 2 :: A resource for global
==============================================================================
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open
Test Case Open Chrome In Real Device                                  | FAIL |
URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
------------------------------------------------------------------------------
Testcase 2 :: A resource for global                                   | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================

I try implemen from Opening Chrome browser in Android device using Robot Framework script and chromedriver?,
but still fail. Is there any setup in my andorid first before i run this test? must create a test server or what ? Thanks for helping

Community
  • 1
  • 1
  • Are you using Appium or Selenium Grid? – Helio Oct 11 '16 at 21:57
  • Im using robotframework which using selenium. – Matius Kristian Oct 12 '16 at 13:15
  • You need to have a server to communicate with your device (I will need to setup Android and iOS tests, and I considering Appium for it). See http://appium.io/ setup Appium and then setup http://jollychang.github.io/robotframework-appiumlibrary But controlling the Android's browser with this solution may not be easy, because we will be using two Webdriver servers. – Helio Oct 12 '16 at 21:11

1 Answers1

0

*** Settings *** Library SeleniumLibrary Library Collections

*** Variables ***

*** Test Cases *** AndroidConnection #${COptions}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver ${Options} Create Dictionary androidPackage com.android.chrome #${prefs} Create Dictionary profile.default_content_setting_values.geolocation=1 #${v} Create Dictionary prefs ${prefs}

#${kwag}  Create Dictionary     chromeOptions=${COptions}
${caps}    Create Dictionary    chromeOptions    ${Options}
#Set to Dictionary    ${caps}   add_experimental_option    ${v}
Set to Dictionary    ${caps}    platformName    Android
Set to Dictionary    ${caps}    platformVersion    9.0
Set To Dictionary    ${caps}    deviceName    emulator-5554
Set To Dictionary    ${caps}    browserName    Chrome
Set To Dictionary    ${caps}   autoGrantPermissions     true
 Set To Dictionary    ${caps}     autoAcceptAlerts   true
#set to dictionary    ${caps}    chromeOptions   ${kwag}
Create Webdriver    Remote    command_executor=http://localhost:4723/wd/hub     desired_capabilities=${caps}
go to   https://the-internet.herokuapp.com/geolocation
#appium --allow-insecure chromedriver_autodownload