You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/capabilities/ReadMe.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
### <imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Using Desired Capabilities
1
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Using Desired Capabilities</h3>
2
2
3
3
You can specify browser desired capabilities for webdriver when running SeleniumBase tests on a remote SeleniumGrid server such as [BrowserStack](https://www.browserstack.com/automate/capabilities) or [Sauce Labs](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/).
4
4
@@ -40,13 +40,15 @@ capabilities = {
40
40
41
41
(Note that the browser is now being specified in the capabilities file, rather than with ``--browser=BROWSER`` when using a **remote** Selenium Grid. If using a **local** Selenium Grid, specify the browser, eg: ``--browser=chrome`` or ``--browser=firefox``.)
42
42
43
-
<b>You can generate specific desired capabilities using:</b>
43
+
<div><b>You can generate specific desired capabilities using:</b></div>
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="32" /> Using Desired Capabilities</h3>
1
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Using Desired Capabilities</h3>
2
2
3
-
You can specify browser desired capabilities for webdriver when running SeleniumBase tests on a remote SeleniumGrid server such as [BrowserStack](https://www.browserstack.com/automate/capabilities), [Sauce Labs](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/), or [TestingBot](https://testingbot.com/support/other/test-options).
3
+
You can specify browser desired capabilities for webdriver when running SeleniumBase tests on a remote SeleniumGrid server such as [BrowserStack](https://www.browserstack.com/automate/capabilities) or [Sauce Labs](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/).
4
4
5
5
Sample run commands may look like this when run from the [SeleniumBase/examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) folder: (The browser is now specified in the capabilities file.)
(Parameters: ``--browser=remote``, ``--server=SERVER``, ``--port=PORT``, and ``--cap_file=CAP_FILE.py``)
16
16
17
17
Here's an example desired capabilities file for BrowserStack:
18
+
18
19
```python
19
20
desired_cap = {
20
-
'os': 'OS X',
21
-
'os_version': 'High Sierra',
22
-
'browser': 'Chrome',
23
-
'browser_version': '77.0',
24
-
'browserstack.local': 'false',
25
-
'browserstack.selenium_version': '3.141.59'
21
+
"os": "OS X",
22
+
"os_version": "Mojave",
23
+
"browser": "Chrome",
24
+
"browser_version": "latest",
25
+
"browserstack.local": "false",
26
+
"browserstack.selenium_version": "3.141.59",
26
27
}
27
28
```
28
29
29
30
Here's an example desired capabilities file for Sauce Labs:
31
+
30
32
```python
31
33
capabilities = {
32
-
'browserName': 'firefox',
33
-
'browserVersion': '70.0',
34
-
'platformName': 'macOS 10.13',
35
-
'sauce:options': {
36
-
}
34
+
"browserName": "chrome",
35
+
"browserVersion": "latest",
36
+
"platformName": "macOS 10.14",
37
+
"sauce:options": {},
37
38
}
38
39
```
39
40
40
-
(You'll notice that the browser is now being specified in the capabilities file, rather than with ``--browser=BROWSER``)
41
+
(Note that the browser is now being specified in the capabilities file, rather than with ``--browser=BROWSER`` when using a **remote** Selenium Grid. If using a **local** Selenium Grid, specify the browser, eg: ``--browser=chrome`` or ``--browser=firefox``.)
42
+
43
+
<div><b>You can generate specific desired capabilities using:</b></div>
41
44
42
-
<b>You can generate specific desired capabilities using:</b>
SeleniumBase has a desired capabilities parser that can capture all lines from the specified file in the following formats:
51
-
``'KEY': 'VALUE'``
52
-
``'KEY': True``
53
-
``'KEY': False``
54
-
``caps['KEY'] = "VALUE"``
55
-
``caps['KEY'] = True``
56
-
``caps['KEY'] = False``
53
+
54
+
```python
55
+
'KEY': 'VALUE'
56
+
'KEY': True
57
+
'KEY': False
58
+
caps['KEY'] ="VALUE"
59
+
caps['KEY'] =True
60
+
caps['KEY'] =False
61
+
```
62
+
57
63
(Each pair must be on a separate line. You can interchange single and double quotes.)
58
64
59
65
You can also swap ``--browser=remote`` with an actual browser, eg ``--browser=chrome``, which will combine the default SeleniumBase desired capabilities with those that were specified in the capabilities file when using ``--cap_file=FILE.py``. Capabilities will override other parameters, so if you set the browser to one thing and the capabilities browser to another, SeleniumBase will use the capabilities browser as the browser.
@@ -67,22 +73,28 @@ You'll need default SeleniumBase capabilities for:
67
73
68
74
You can also set browser desired capabilities from a command line string:
0 commit comments