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
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
<h3><imgsrc="https://seleniumbase.github.io/img/green_logo.png"title="SeleniumBase"width="32" /> Using Desired Capabilities</h3>
4
4
5
-
You can specify browser capabilities when running SeleniumBase tests on a remote Selenium Grid server such as <ahref="https://www.browserstack.com/automate/capabilities"target="_blank">BrowserStack</a>, <ahref="https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/"target="_blank">Sauce Labs</a>, or another.
5
+
You can specify browser capabilities when running SeleniumBase tests on a remote Selenium Grid server such as <ahref="https://www.browserstack.com/automate/capabilities"target="_blank">BrowserStack</a>, <ahref="https://saucelabs.com/products/platform-configurator"target="_blank">Sauce Labs</a>, or another.
6
6
7
7
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.)
<h3><imgsrc="https://seleniumbase.github.io/img/green_logo.png"title="SeleniumBase"width="32" /> Running tests on a remote Selenium Grid:</h3>
454
454
455
-
🌐 SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium)'s Selenium Grid, other Grids, and even your own Grid:
455
+
🌐 SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/platform-configurator)'s Selenium Grid, other Grids, and even your own Grid:
456
456
457
457
🌐 For setting browser desired capabilities while running Selenium remotely, see the ReadMe located here: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities
Copy file name to clipboardExpand all lines: help_docs/desired_capabilities.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## [<imgsrc="https://seleniumbase.github.io/img/logo6.png"title="SeleniumBase"width="32">](https://github.com/seleniumbase/SeleniumBase/) Using Desired Capabilities
4
4
5
-
You can specify browser capabilities when running SeleniumBase tests on a remote Selenium Grid server such as <ahref="https://www.browserstack.com/automate/capabilities"target="_blank">BrowserStack</a> or <ahref="https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/"target="_blank">Sauce Labs</a>.
5
+
You can specify browser capabilities when running SeleniumBase tests on a remote Selenium Grid server such as <ahref="https://www.browserstack.com/automate/capabilities"target="_blank">BrowserStack</a> or <ahref="https://saucelabs.com/products/platform-configurator"target="_blank">Sauce Labs</a>.
6
6
7
7
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.)
Copy file name to clipboardExpand all lines: help_docs/how_it_works.md
+41-17Lines changed: 41 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,17 @@
4
4
5
5
<aid="how_seleniumbase_works"></a>
6
6
7
-
👁️🔎 At the core, SeleniumBase works by extending [pytest](https://docs.pytest.org/en/latest/) as a direct plugin. SeleniumBase automatically spins up web browsers for tests (using [Selenium WebDriver](https://www.selenium.dev/documentation/webdriver/)), and then gives those tests access to the SeleniumBase libraries through the [BaseCase class](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py). Tests are also given access to [SeleniumBase command-line options](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md) and [SeleniumBase methods](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md), which provide additional functionality.
7
+
👁️🔎 The primary [SeleniumBase syntax format](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md) works by extending [pytest](https://docs.pytest.org/en/latest/) as a direct plugin. SeleniumBase automatically spins up web browsers for tests (using [Selenium WebDriver](https://www.selenium.dev/documentation/webdriver/)), and then gives those tests access to the SeleniumBase libraries through the [BaseCase class](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py). Tests are also given access to [SeleniumBase command-line options](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md) and [SeleniumBase methods](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md), which provide additional functionality.
8
8
9
9
👁️🔎 ``pytest`` uses a feature called test discovery to automatically find and run Python methods that start with ``test_`` when those methods are located in Python files that start with ``test_`` or end with ``_test.py``.
10
10
11
-
👁️🔎 The most common way of using **SeleniumBase** is by importing ``BaseCase``:
11
+
👁️🔎 The primary [SeleniumBase syntax format](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md) starts by importing ``BaseCase``:
12
12
13
13
```python
14
14
from seleniumbase import BaseCase
15
15
```
16
16
17
-
👁️🔎 This line activates ``pytest`` when a file is called directly with ``python``:
17
+
👁️🔎 This next line activates ``pytest`` when a file is called directly with ``python`` by accident:
18
18
19
19
```python
20
20
BaseCase.main(__name__, __file__)
@@ -29,12 +29,16 @@ class MyTestClass(BaseCase):
29
29
👁️🔎 Test methods inside ``BaseCase`` classes become SeleniumBase tests: (These tests automatically launch a web browser before starting, and quit the web browser after ending. Default settings can be changed via command-line options.)
30
30
31
31
```python
32
+
classMyTestClass(BaseCase):
32
33
deftest_abc(self):
34
+
# ...
33
35
```
34
36
35
-
👁️🔎 SeleniumBase APIs can be called from tests via ``self``:
37
+
👁️🔎 [SeleniumBase APIs](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md) can be called from tests via ``self``:
self.highlight("img#image1") # A fancier assert_element() call
55
-
self.click('a:contains("This Page")') # Use :contains() on any tag
56
-
self.save_screenshot_to_logs() # ("./latest_logs" folder for test)
57
-
self.click_link("Sign out") # Link must be "a" tag. Not "button".
58
-
self.assert_element('a:contains("Sign in")')
59
-
self.assert_exact_text("You have been signed out!", "#top_message")
56
+
self.click('a:contains("Sign in")')
57
+
self.assert_exact_text("Welcome!", "h1")
58
+
self.assert_element("img#image1")
59
+
self.highlight("#image1")
60
+
self.click_link("Sign out")
61
+
self.assert_text("signed out", "#top_message")
60
62
```
61
63
62
-
(See the example, [test_mfa_login.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_mfa_login.py), for reference.)
64
+
(See the example, [test_simple_login.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_simple_login.py), for reference.)
63
65
64
66
👁️🔎 Here are some examples of running tests with ``pytest``:
65
67
@@ -71,7 +73,29 @@ pytest -k agent
71
73
pytest offline_examples/
72
74
```
73
75
74
-
(See <ahref="https://seleniumbase.io/help_docs/syntax_formats/">Syntax_Formats</a> for more ways of structuring <b>SeleniumBase</b> tests.)
76
+
👁️🔎 Here's a [SeleniumBase syntax format](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md) that uses the raw `driver`. Unlike the format mentioned earlier, it can be run with `python` instead of `pytest`. The `driver` includes original `driver` methods and new ones added by SeleniumBase:
(See the example, [raw_login_driver.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_driver.py), for reference.)
97
+
98
+
👁️🔎 Note that regular SeleniumBase formats (ones that use `BaseCase`, the `SB` context manager, or the `sb``pytest` fixture) have more methods than the improved `driver` format. The regular formats also have more features. Some features, (such as the [SeleniumBase dashboard](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md)), require a `pytest` format.
0 commit comments