How To - start REMOTE chrome webdriver with desired chromeOption

3,639 views
Skip to first unread message

Tset Noitamotua

unread,
Nov 13, 2015, 2:42:04 AM11/13/15
to robotframework-users
How to use Chrome WebDriver on Selenium Server Standalone[1] with chromeOptions[2]:

Here a small example for the chromeOption '--lang=xx'  where 'xx' are two characters defining the language, e.g. '--lang=de' for German.

In Python interactive shell:

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--lang=de")
chrome_remote = 
webdriver.Remote('http://hostname:4444/wd/hub', options.to_capabilities())


In Robot Framework syntax:

| Start Google Chrome Remote
| | [Arguments]      | ${url}
| | [Documentation]  | Starts Google Chrome browser on Selenium Server Standalone.
| | ${options}=  | Evaluate   | sys.modules['selenium.webdriver'].ChromeOptions() | sys
| | Call Method  | ${options} | add_argument | --lang\=de     # NOTE: important to escape equal sign '\='
| | ${options}=  | Call Method  | ${options} | to_capabilities
| | Create WebDriver | Remote | command_executor=http://hostname:4444/wd/hub | desired_capabilities=${options}
| | # NOTE: replace 'hostname' with hastname or IP of your remote machine running the Selenium Server  
| | Go To                       | ${url}
| | Maximize Browser Window     |

Similar context:
How To - use LOCAL chrome webdriver with chromeOption '--lang=de' [3] 
How To - use local / remote Chrome Webdriver with current user data[4]



Nadia García

unread,
Oct 3, 2017, 3:21:36 PM10/3/17
to robotframework-users
This was very very very helpful!

Thank you!

Wlad

unread,
Oct 9, 2017, 5:28:21 PM10/9/17
to na...@sawyereffect.com, robotframework-users
Nice to hear that :)
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages