1

Automation setup on Ubuntu 14.04:

Robot Framework 2.9.2 (Python 2.7.6 on linux2)
selenium2library-1.7.4
ChromeDriver 2.20.353124
Device under testing:  Nexus 7 (KitKat 4.4, Chrome v. 47)

Everything works fine when running this following example test with Python --> URL is launched properly on Chrome in Nexus device.

    from selenium import webdriver
capabilities = {
  'chromeOptions': {
    'androidPackage': 'com.android.chrome',
  }
}
driver = webdriver.Remote('http://localhost:9515', capabilities)
driver.get('http://google.com')
driver.quit()

But actual problem exists when I try to get the same working with Robot Framework script. I've tried several ways but always it just opens URL on desktop Chrome browser - not in mobile (Nexus tablet) as it should be.

The following RF script was my latest try. I think problem is related somehow to desired_capabilities but I just haven't find the correct way how it should be defined

*** Settings ***
Library         Selenium2Library
*** Variables ***
${chromedriver}    http://localhost:9515
${android} =    Create List   androidPackage    com.android.chrome  
${desired_capabilities} =    Create Dictionary   {chromedriver}    chromeOptions    ${android}

*** Keywords ***
Open Page
    Open Browser    http://www.google.com 
    ... browser=chrome   
    ... desired_capabilities=${desired_capabilities}

Anyone had same issue? What I'm doing wrong?

jakulepi
  • 11
  • 1
  • 2

1 Answers1

1

The desired capabilities argument is not processed for local webdrivers. Until that is resolved you can use the more flexible Create Webdriver keyword instead of Open Browser. I cannot speak to whether this is the best way to launch Chrome on Android, but here is a direct translation of your Python code:

${options}=    Create Dictionary    androidPackage=com.android.chrome
${caps}=    Create Dictionary    chromeOptions=${options}
Create Webdriver    Remote    command_executor=http://localhost:9515    desired_capabilities=${caps}
Go To    http://google.com
Close Browser
ombre42
  • 2,344
  • 15
  • 21
  • Thank you! Now it works and Chrome browser is opened in device - not in desktop. You don't believe how many hours I spent trying to resolve this problem... – jakulepi Dec 29 '15 at 18:38
  • you know, I'm not sure the above is necessary. Have you tried adding remote_url=`http://localhost:9515` to Open Browser? The only difference I think would be additional capabilities of "browserName": "chrome", "platform": "ANY", and "javascriptEnabled": True. – ombre42 Dec 29 '15 at 19:04