chromedriver desired_capabilities passing

1,240 views
Skip to first unread message

Jerry Schneider

unread,
Jun 11, 2014, 6:49:40 PM6/11/14
to robotframework-users
I have been trying to get rid of the banner
(--ignore-certificate-errors) that is now appearing when we do Chrome
browser testing with our app. Unfortunately I am not having any success
and could really use some help.

Comment Open Browser and go to site
Open Browser http://${WebHost} ${Browser} ${BrowserAlias}
\ desired_capabilities=test-type:true

or

Comment Open Browser and go to site
Open Browser http://${WebHost} ${Browser} ${BrowserAlias}
\ desired_capabilities=test-type

or

Comment Open Browser and go to site
Open Browser http://${WebHost} ${Browser} ${BrowserAlias}
\ test-type:true

or

Comment Open Browser and go to site
Open Browser http://${WebHost} ${Browser} ${BrowserAlias}
\ test-type

No Joy, banner remains. Can anyone tell me what I am missing or getting
wrong here?

Thanks ahead of time!

jer

--
Linux registered user #475536
Ubuntu registered user #28583

Kevin O.

unread,
Jun 11, 2014, 10:43:18 PM6/11/14
to robotframe...@googlegroups.com, jer...@gmail.com
Jerry,
You are using a "local" webdriver. In this scenario, Open Browser ignores the desired_capabilities argument.
As a workaround for issues like this and due to the disparity in each browser's constructor's, I added the Create Webdriver keyword in the last release of Selenium2Library. I came up with a test that ignored a bad certificate and didn't see any banner. It is ugly I know.

    ${chrome options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys
    Call Method    ${chrome options}    add_argument    test-type
    Create Webdriver    Chrome    my_alias    chrome_options=${chrome options}

It is probably possible to add test-type directly to desired capabilites and avoid using the ChromeOptions helper class. I went by what I found Googling and got something working, so I'll leave that to you.

Cheers,
Kevin

Jerry Schneider

unread,
Jun 12, 2014, 12:41:38 AM6/12/14
to Kevin O., robotframe...@googlegroups.com
thanks will check it out.

jer

Kevin O.

unread,
Jun 12, 2014, 9:53:43 AM6/12/14
to robotframe...@googlegroups.com, korm...@gmail.com, jer...@gmail.com
I did try and see if you could modify the default desired capabilities for Chrome and use Open Browser instead of Create Webdriver.
When using Open Browser, desired_capabilities and chrome_options are both None for Chrome's __init__.
In this scenario, a ChromeOptions instance is constructed and to_capabilities is used to convert to desired capabilities.
The to_capabilities method always replaces the chromeOptions entry in the desired capabilities dict.
In other words, storing any chrome options in the default desired capabilties (selenium.webdriver.DesiredCapabilities.CHROME) has no effect.

FYI the desired capabilities entry for the Chrome option test-type looks like this:
'chromeOptions': {'args': [u'test-type'], 'extensions': []}
Reply all
Reply to author
Forward
0 new messages