Devendra Sharma
Devendra Sharma

Reputation: 147

Configuring portable browser binary via Robot framework

I need to run my Robot test scripts using portable browsers of specific versions, instead of the one those are installed on the host machine. How can I achieve this? Is there any option available in Selenium Capabilities?

My requirement is for Chrome, IE, and Firefox - all these browser's portable versions.

Upvotes: 0

Views: 1958

Answers (3)

bennyvw
bennyvw

Reputation: 11

Can be done this way (same answer as @GPT14, but more complete):

${options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
${prefs}       Create Dictionary
Call Method    ${options}    add_experimental_option    prefs    ${prefs}
${options.binary_location}    Set Variable    ${setYourPathToChromePortableHere}
Create Webdriver    Chrome    chrome_options=${options}
Go To    ${URL}

Upvotes: 1

GPT14
GPT14

Reputation: 819

You can use the following method to specify the binary file location as an experimental option before calling Create Webdriver keyword.

Call Method ${chromeOptions}    add_experimental_option prefs   ${prefs}
${chromeOptions.binary_location}    Set Variable    <insert your path here>     
Create Webdriver    Chrome  chrome_options=${chromeOptions}

Upvotes: 1

Helio
Helio

Reputation: 3737

A possibility is to manipulate the PATH environment variable so that it finds the portable browser first that the installed one (and before calling Create Webdriver or Open Browser).

This can be done using OperatingSystem keywords, like for example, Set Environment Variable.

Upvotes: 0

Related Questions