@@ -125,7 +125,8 @@ def open_browser(self, url=None, browser='firefox', alias=None,
125
125
and attributes to define the profile using methods and attributes
126
126
in the same way as with ``options`` argument. Example: It is possible
127
127
to use FirefoxProfile `set_preference` to define different
128
- profile settings.
128
+ profile settings. See ``options`` argument documentation in below
129
+ how to handle backslash escaping.
129
130
130
131
Optional ``options`` argument allows defining browser specific
131
132
Selenium options. Example for Chrome, the ``options`` argument
@@ -177,7 +178,16 @@ def open_browser(self, url=None, browser='firefox', alias=None,
177
178
`add_argument ( "--headless" )` is same as
178
179
`add_argument("--headless")`. But `add_argument(" --headless ")` is
179
180
not same same as `add_argument ( "--headless" )`, because
180
- spaces inside of quotes are not removed.
181
+ spaces inside of quotes are not removed. Please note that if
182
+ options string contains backslash, example a Windows OS path,
183
+ the backslash needs escaping both in Robot Framework data and
184
+ in Python side. This means single backslash must be writen using
185
+ four backslash characters. Example, Windows path:
186
+ "C:\\ path\\ to\\ profile" must be written as
187
+ "C:\\ \\ \\ \\ path\\ \\ \\ to\\ \\ \\ \\ profile". Another way to write
188
+ backslash is use Python
189
+ [https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals|raw strings]
190
+ and example write: r"C:\\ \\ path\\ \\ to\\ \\ profile".
181
191
182
192
As last format, ``options`` argument also supports receiving
183
193
the Selenium options as Python class instance. In this case, the
@@ -229,15 +239,16 @@ def open_browser(self, url=None, browser='firefox', alias=None,
229
239
Example when using
230
240
[https://seleniumhq.github.io/selenium/docs/api/py/webdriver_chrome/selenium.webdriver.chrome.options.html#selenium.webdriver.chrome.options.Options|Chrome options]
231
241
method:
232
- | `Open Browser` | http://example.com | Chrome | options=add_argument("--disable-popup-blocking"); add_argument("--ignore-certificate-errors") | # Sting format |
233
- | ${options} = | Get Options | | | # Selenium options instance |
234
- | `Open Browser` | http://example.com | Chrome | options=${options} | |
235
- | `Open Browser` | None | Chrome | options=binary_location="/path/to/binary";add_argument("remote-debugging-port=port") | # Start Chomium-based application |
242
+ | `Open Browser` | http://example.com | Chrome | options=add_argument("--disable-popup-blocking"); add_argument("--ignore-certificate-errors") | # Sting format. |
243
+ | ${options} = | Get Options | | | # Selenium options instance. |
244
+ | `Open Browser` | http://example.com | Chrome | options=${options} | |
245
+ | `Open Browser` | None | Chrome | options=binary_location="/path/to/binary";add_argument("remote-debugging-port=port") | # Start Chomium-based application. |
246
+ | `Open Browser` | None | Chrome | options=binary_location=r"C:\\ \\ path\\ \\ to\\ \\ binary" | # Windows OS path escaping. |
236
247
237
248
Example for FirefoxProfile
238
- | `Open Browser` | http://example.com | Firefox | ff_profile_dir=/path/to/profile | # Using profile from disk |
239
- | `Open Browser` | http://example.com | Firefox | ff_profile_dir=${FirefoxProfile_instance} | # Using instance of FirefoxProfile |
240
- | `Open Browser` | http://example.com | Firefox | ff_profile_dir=set_preference("key", "value");set_preference("other", "setting") | # Defining profile using FirefoxProfile mehtods |
249
+ | `Open Browser` | http://example.com | Firefox | ff_profile_dir=/path/to/profile | # Using profile from disk. |
250
+ | `Open Browser` | http://example.com | Firefox | ff_profile_dir=${FirefoxProfile_instance} | # Using instance of FirefoxProfile. |
251
+ | `Open Browser` | http://example.com | Firefox | ff_profile_dir=set_preference("key", "value");set_preference("other", "setting") | # Defining profile using FirefoxProfile mehtods. |
241
252
242
253
If the provided configuration options are not enough, it is possible
243
254
to use `Create Webdriver` to customize browser initialization even
0 commit comments