Skip to content

Commit 56b6f5b

Browse files
committed
Update the docs
1 parent 0a52cac commit 56b6f5b

File tree

2 files changed

+50
-36
lines changed

2 files changed

+50
-36
lines changed

examples/capabilities/ReadMe.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### <img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Using Desired Capabilities
1+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Using Desired Capabilities</h3>
22

33
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#/).
44

@@ -40,13 +40,15 @@ capabilities = {
4040

4141
(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``.)
4242

43-
<b>You can generate specific desired capabilities using:</b>
43+
<div><b>You can generate specific desired capabilities using:</b></div>
44+
4445
<ul>
4546
<li><a href="https://www.browserstack.com/automate/capabilities">BrowserStack desired capabilities</a></li>
4647
<li><a href="https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/">Sauce Labs desired capabilities</a></li>
4748
</ul>
4849

49-
<b>Parsing desired capabilities:</b>
50+
<div><b>Parsing desired capabilities:</b></div>
51+
5052
SeleniumBase has a desired capabilities parser that can capture all lines from the specified file in the following formats:
5153

5254
```python
@@ -81,18 +83,18 @@ pytest test_swag_labs.py --cap-string='{"browserName":"chrome","name":"test1"}'
8183
If you pass ``"*"`` into the ``"name"`` field of ``--cap-string``, the name will become the test identifier. Example:
8284

8385
```bash
84-
pytest test_swag_labs.py --cap-string='{"browserName":"chrome","name":"*"}' --server="127.0.0.1" --browser=chrome
86+
pytest my_first_test.py --cap-string='{"browserName":"chrome","name":"*"}' --server="127.0.0.1" --browser=chrome
8587
```
8688

8789
Example name: ``"my_first_test.MyTestClass.test_basics"``
8890

89-
### Using a local Selenium Grid
91+
<h3>Using a local Selenium Grid</h3>
9092

9193
If using a local Selenium Grid with SeleniumBase, start up the Grid Hub and nodes first:
9294

9395
```bash
94-
seleniumbase grid-hub start
95-
seleniumbase grid-node start
96+
sbase grid-hub start
97+
sbase grid-node start
9698
```
9799

98100
(The Selenium Server JAR file will be automatically downloaded for first-time Grid users. You'll also need Java installed to start up the Grid.)

help_docs/desired_capabilities.md

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,65 @@
1-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Using Desired Capabilities</h3>
1+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Using Desired Capabilities</h3>
22

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#/).
44

55
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.)
66

77
```bash
8-
pytest my_first_test.py --browser=remote --server=USERNAME:[email protected] --port=80 --cap_file=capabilities/sample_cap_file_BS.py
8+
pytest test_demo_site.py --browser=remote --server=USERNAME:[email protected] --port=80 --cap_file=capabilities/sample_cap_file_BS.py
99
```
1010

1111
```bash
12-
pytest my_first_test.py --browser=remote --server=USERNAME:[email protected] --port=80 --cap_file=capabilities/sample_cap_file_SL.py
12+
pytest test_demo_site.py --browser=remote --server=USERNAME:KEY@ondemand.us-east-1.saucelabs.com --port=443 --protocol=https --cap_file=capabilities/sample_cap_file_SL.py
1313
```
1414

1515
(Parameters: ``--browser=remote``, ``--server=SERVER``, ``--port=PORT``, and ``--cap_file=CAP_FILE.py``)
1616

1717
Here's an example desired capabilities file for BrowserStack:
18+
1819
```python
1920
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",
2627
}
2728
```
2829

2930
Here's an example desired capabilities file for Sauce Labs:
31+
3032
```python
3133
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": {},
3738
}
3839
```
3940

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>
4144

42-
<b>You can generate specific desired capabilities using:</b>
4345
<ul>
4446
<li><a href="https://www.browserstack.com/automate/capabilities">BrowserStack desired capabilities</a></li>
4547
<li><a href="https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/">Sauce Labs desired capabilities</a></li>
46-
<li><a href="https://testingbot.com/support/other/test-options">TestingBot desired capabilities</a></li>
4748
</ul>
4849

49-
<b>Parsing desired capabilities:</b>
50+
<div><b>Parsing desired capabilities:</b></div>
51+
5052
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+
5763
(Each pair must be on a separate line. You can interchange single and double quotes.)
5864

5965
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:
6773

6874
You can also set browser desired capabilities from a command line string:
6975
Example:
76+
7077
```bash
7178
pytest test_swag_labs.py --cap-string='{"browserName":"chrome","name":"test1"}' --server="127.0.0.1" --browser=remote
7279
```
80+
7381
(Enclose cap-string in single quotes. Enclose parameter keys in double quotes.)
7482

7583
If you pass ``"*"`` into the ``"name"`` field of ``--cap-string``, the name will become the test identifier. Example:
84+
7685
```bash
77-
pytest test_swag_labs.py --cap-string='{"browserName":"chrome","name":"*"}' --server="127.0.0.1" --browser=chrome
86+
pytest my_first_test.py --cap-string='{"browserName":"chrome","name":"*"}' --server="127.0.0.1" --browser=chrome
7887
```
88+
7989
Example name: ``"my_first_test.MyTestClass.test_basics"``
8090

81-
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Using a local Selenium Grid</h3>
91+
<h3>Using a local Selenium Grid</h3>
8292

8393
If using a local Selenium Grid with SeleniumBase, start up the Grid Hub and nodes first:
94+
8495
```bash
85-
seleniumbase grid-hub start
86-
seleniumbase grid-node start
96+
sbase grid-hub start
97+
sbase grid-node start
8798
```
99+
88100
(The Selenium Server JAR file will be automatically downloaded for first-time Grid users. You'll also need Java installed to start up the Grid.)

0 commit comments

Comments
 (0)