Reputation: 81
I wish to open mobile browsers (device browser on android phones and safari on apple ios phones) using Appium Library in Robotframework (Python) and SauceLabs.
I can get the Desired Capabilities from the Saucelabs Platform Configurator.
But I cannot pass them along with the ${remote_url} and ${desired_capabilities} to the "Open Browser" method.
When I do, it launches the mobile device emulator/simulator and the browser but does not input the URL in the address bar.
Upvotes: 0
Views: 2425
Reputation: 81
For iOS,
**** Settings ****
Suite Setup Set Library Search Order Selenium2Library
Test Setup Open page
Test Teardown Close Page
Library Selenium2Library
Library Collections
Library SauceLabs
Library requests
Library AppiumLibrary
**** Test Cases ****
Test_case_sample
**** Keywords ****
Open Page
${desired_capabilities}= Create Dictionary
Set to Dictionary ${desired_capabilities} deviceName iPhone 6 Simulator
Set to Dictionary ${desired_capabilities} build test_run
Set to Dictionary ${desired_capabilities} platformName iOS
Set to Dictionary ${desired_capabilities} name test_name
Set to Dictionary ${desired_capabilities} platformVersion 10.0
Set to Dictionary ${desired_capabilities} deviceOrientation portrait
Set to Dictionary ${desired_capabilities} browserName Safari
Set to Dictionary ${desired_capabilities} appiumVersion 1.6.3
Set to Dictionary ${desired_capabilities} deviceType phone
${executor}= Evaluate str('http://my_sauce_username:[email protected]:80/wd/hub')
Create Webdriver Remote desired_capabilities=${desired_capabilities} command_executor=${executor}
Go To https://www.google.com
Close Page
Run Keyword If '${REMOTE_URL}' != '' Report Sauce Status ${SUITE_NAME} \| ${TEST_NAME} ${TEST_STATUS} ${TEST_TAGS} ${REMOTE_URL}
For Android, just change the following desired capabilities:
**** Settings ****
Suite Setup Set Library Search Order Selenium2Library
Test Setup Open page
Test Teardown Close Page
Library Selenium2Library
Library Collections
Library SauceLabs
Library requests
Library AppiumLibrary
**** Test Cases ****
Test_case_sample
**** Keywords ****
Open Page
${desired_capabilities}= Create Dictionary
Set to Dictionary ${desired_capabilities} deviceName Android Emulator
Set to Dictionary ${desired_capabilities} build test_run
Set to Dictionary ${desired_capabilities} platformName Android
Set to Dictionary ${desired_capabilities} name test_name
Set to Dictionary ${desired_capabilities} platformVersion 5.1
Set to Dictionary ${desired_capabilities} deviceOrientation portrait
Set to Dictionary ${desired_capabilities} browserName Browser
Set to Dictionary ${desired_capabilities} appiumVersion 1.5.3
Set to Dictionary ${desired_capabilities} deviceType phone
${executor}= Evaluate str('http://my_sauce_username:[email protected]:80/wd/hub')
Create Webdriver Remote desired_capabilities=${desired_capabilities} command_executor=${executor}
Go To https://www.google.com
Close Page
Run Keyword If '${REMOTE_URL}' != '' Report Sauce Status ${SUITE_NAME} \| ${TEST_NAME} ${TEST_STATUS} ${TEST_TAGS} ${REMOTE_URL}
For additional mobile device capabilities, please refer to Saucelabs Platform Configurator
Upvotes: 1