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
(<i>Requires [Git](https://git-scm.com/) and [Python](https://www.python.org/downloads/)[<imgsrc="https://img.shields.io/badge/python-2.7,_3.x-22AADD.svg"alt="Python versions" />](https://www.python.org/downloads/). Optionally, you may want to use a [Python virtual environment](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md) to isolate Python dependencies between projects.</i>)
15
+
(<i>Requires **[Git and Python/Pip](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/install_python_pip_git.md)**[<imgsrc="https://img.shields.io/badge/python-2.7,_3.x-22AADD.svg"alt="Python versions" />](https://www.python.org/downloads/). Optionally, you may want to use a [Python virtual environment](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md) to isolate Python dependencies between projects.</i>)
16
16
17
-
#### Clone SeleniumBase from GitHub:
17
+
**Make sure you're using the latest versions of Pip and Setuptools:**
* (Depending on your user permissions, you may need to add ``--user`` to the command if you're not inside a [Python virtual environment](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md), or use "[sudo](https://en.wikipedia.org/wiki/Sudo)" on a UNIX-based OS if you're getting errors during installation.)
21
22
22
-
#### Upgrade [pip](https://pypi.org/project/pip/) and [setuptools](https://pypi.org/project/setuptools/) to the latest versions:
* (Depending on your user permissions, you may need to add ``--user`` to the command if you're not inside a [Python virtual environment](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md), or use "[sudo](https://en.wikipedia.org/wiki/Sudo)" on a UNIX-based OS if you're getting errors during installation.)
27
+
(<i>A Git GUI tool like [SourceTree](https://www.sourcetreeapp.com/) or [GitHub Desktop](https://desktop.github.com/) may help.</i>)
27
28
28
29
#### Install SeleniumBase:
30
+
If installing SeleniumBase from a local clone, use:
29
31
```
30
32
cd SeleniumBase
31
-
pip install -U -r requirements.txt
33
+
pip install -r requirements.txt -U
32
34
python setup.py install
33
35
```
34
-
* (Use ``python setup.py develop`` if configuring seleniumbase inside a virtual environment.)
35
-
* (You can also get seleniumbase from the Python Package Index, [<imgsrc="https://img.shields.io/pypi/v/seleniumbase.svg"alt="Version" />](https://pypi.python.org/pypi/seleniumbase))
36
+
* (Use ``python setup.py develop`` if inside a virtual environment.)
36
37
37
-
#### Install a web driver to the [seleniumbase/drivers](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/drivers) folder:
38
+
If installing SeleniumBase from [PyPI](https://pypi.python.org/pypi/seleniumbase)[<imgsrc="https://img.shields.io/badge/pypi-seleniumbase-22AAEE.svg"alt="pypi" />](https://pypi.python.org/pypi/seleniumbase), use:
#### Download a web driver to your System Path or to the [seleniumbase/drivers](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/drivers) folder:
49
+
50
+
SeleniumBase can download a driver to the seleniumbase/drivers folder with the ``install`` command:
51
+
```
52
+
seleniumbase install chromedriver
53
+
```
42
54
* (You need a different web driver for each web browser you want to run automation on: ``chromedriver`` for Chrome, ``edgedriver`` for Edge, ``geckodriver`` for Firefox, ``operadriver`` for Opera, and ``iedriver`` for Internet Explorer.)
43
55
44
56
#### Run a test on Chrome:
45
57
```
46
58
cd examples
47
59
pytest my_first_test.py --browser=chrome
48
60
```
49
-
50
61
* (Chrome is the default browser if not specified with ``--browser``)
Check out [SeleniumBase Website Tours](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/tour_examples) (in the ``examples/tour_examples`` folder). It's great for prototyping a website onboarding experience. See the [Tours ReadMe](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md) for more details.
55
-
56
-
```
57
-
cd tour_examples
58
-
pytest google_tour.py
59
-
```
63
+
**Here's what [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) looks like:**
60
64
61
-
<imgsrc="https://cdn2.hubspot.net/hubfs/100006/google_tour_3.gif"title="SeleniumBase Tour of Google"height="260"><br>
62
-
(Above: Actual demo of [google_tour.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/google_tour.py) running on [google.com](https://google.com))
SeleniumBase automatically handles common WebDriver actions such as spinning up web browsers, waiting for page objects to load, saving screenshots during test failures, using a proxy server, and more. (<i>[Read about customizing test runs](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md).</i>)
72
-
73
-
#### **Simple Python syntax makes coding easy:**<br />
SeleniumBase automatically handles common WebDriver actions such as spinning up web browsers and saving screenshots during test failures. (<i>[Read more about customizing test runs](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md).</i>)
76
91
77
-
(<i>By default, [CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp) are used for finding page elements.</i>)
92
+
#### **Simplified code:**<br />
93
+
Instead of using messy WebDriver commands such as:
(<i>You can still use ``self.driver`` in your code.</i>)
78
102
79
103
#### **Run tests with Pytest or Nose in any browser:**<br />
80
104
(<i>Using **Pytest** is strongly recommended</i>)
81
-
82
105
```
83
106
pytest my_first_test.py --browser=chrome
84
107
85
108
nosetests test_suite.py --browser=firefox
86
109
```
87
-
88
110
Python methods that start with ``test_`` will automatically be run when using ``pytest`` or ``nosetests`` on a Python file, (<i>or on folders containing Python files</i>).
(<i>You can still use ``self.driver`` in your code.</i>)
100
-
101
112
#### **No more flaky tests:**<br />
102
-
SeleniumBase methods automatically wait for page elements to finish loading before interacting with them (*up to a timeout limit*). This means you no longer need random ``time.sleep()`` statements in your code.
103
-
104
-
#### **Assist manual QA with automation:**<br />
105
-
SeleniumBase includes an automated/manual hybrid solution called **[MasterQA](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/masterqa/ReadMe.md)**, which speeds up manual testing by having automation perform all the web browser actions while the manual tester only validates what is seen.
106
-
107
-
#### **Integrate with your favorite tools:**<br />
108
-
SeleniumBase is compatible with [Selenium Grid](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/utilities/selenium_grid), [MySQL](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/testcase_manager.py), [Docker](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/docker/ReadMe.md), [NodeJS](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/node_js), [Google Cloud](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/google_cloud/ReadMe.md), and [AWS](#amazon_section).
109
-
110
-
#### **Automate tedious business tasks:**<br />
111
-
Beyond test automation, SeleniumBase is perfect for automating tedious business tasks that you would perform in a web browser.
113
+
SeleniumBase methods automatically wait for page elements to finish loading before interacting with them (*up to a timeout limit*). This means you no longer need random ``time.sleep()`` statements in your scripts.
112
114
113
-
#### **Lots of happy users & customers:**<br />
114
-
To learn about businesses using SeleniumBase, [Click Here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/happy_customers.md).
115
+
#### **Automated/manual hybrid mode:**<br />
116
+
SeleniumBase includes a solution called **[MasterQA](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/masterqa/ReadMe.md)**, which speeds up manual testing by having automation perform all the browser actions while the manual tester handles validatation.
115
117
116
118
#### **Feature-Rich:**<br />
117
-
To see a full list of SeleniumBase features, [Click Here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md).
119
+
For a full list of SeleniumBase features, [Click Here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md).
(<i>A [Git](https://git-scm.com/) GUI tool like [SourceTree](https://www.sourcetreeapp.com/) may help.</i>)
133
-
134
-
### <imgsrc="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png"title="SeleniumBase"height="32"> **Step 2:** Create a Virtual Environment
135
-
136
-
(OPTIONAL) To learn how to create a Python virtual environment, [see this ReadMe](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md).
If you're installing SeleniumBase from a cloned copy on your machine, use:
141
-
```
142
-
cd SeleniumBase
143
-
144
-
pip install -r requirements.txt --upgrade
145
-
python setup.py install
146
-
```
147
-
148
-
If you're installing SeleniumBase from the [Python Package Index](https://pypi.python.org/pypi/seleniumbase)[<imgsrc="https://img.shields.io/badge/pypi-seleniumbase-22AAEE.svg"alt="pypi" />](https://pypi.python.org/pypi/seleniumbase), use:
149
-
```
150
-
pip install -U seleniumbase --no-cache-dir
151
-
```
152
-
153
-
If you're installing SeleniumBase directly from GitHub, use:
(If you encounter permission errors during installation while not using a virtual environment, you may need to add ``--user`` to your pip command. If you already have an older version of SeleniumBase installed, you may want to add ``--upgrade`` or ``-U`` to your pip command.)
159
-
160
-
<aid="seleniumbase_install_a_web_driver"></a>
161
-
### <imgsrc="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png"title="SeleniumBase"height="32"> **Step 4:** Install a Web Driver
162
-
163
-
SeleniumBase requires a web driver to run automation on web browers. For that, you'll need to either download a web driver to your path, or **[install a web driver](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/webdriver_installation.md)** with the SeleniumBase ``install`` command.
164
-
165
-
```
166
-
seleniumbase install chromedriver
167
-
seleniumbase install geckodriver
168
-
seleniumbase install edgedriver
169
-
```
170
-
171
-
(``geckodriver`` is the offical name of the Firefox driver)
172
-
173
-
<aid="seleniumbase_basic_usage"></a>
174
-
### <imgsrc="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png"title="SeleniumBase"height="32"> **Step 5:** Run the Example Script
175
-
176
-
**Here's what the example script, [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py), looks like:**
177
-
178
-
```python
179
-
from seleniumbase import BaseCase
180
-
181
-
classMyTestClass(BaseCase):
182
-
183
-
deftest_basic(self):
184
-
self.open("https://xkcd.com/353/")
185
-
self.assert_element('img[alt="Python"]')
186
-
self.click('a[rel="license"]')
187
-
self.assert_text("free to copy", "div center")
188
-
self.open("https://xkcd.com/1481/")
189
-
title =self.get_attribute("#comic img", "title")
190
-
self.assert_true("86,400 seconds per day"in title)
191
-
self.click("link=Blag")
192
-
self.assert_text("The blag of the webcomic", "h2")
193
-
self.update_text("input#s", "Robots!\n")
194
-
self.assert_text("Hooray robots!", "#content")
195
-
self.open("https://xkcd.com/1319/")
196
-
self.assert_exact_text("Automation", "#ctitle")
197
-
```
198
-
(<i>By default, [CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp) are used for finding page elements.</i>)
199
-
200
127
**Here's how to run the example script on various web browsers:**
201
128
202
129
(NOTE: You can interchange **pytest** with **nosetests** at anytime.)
(<i>If no browser is specified, Chrome is used by default.</i>)
212
138
213
139
<aid="seleniumbase_demo_mode"></a>
214
-
If the example test is moving too fast for your eyes to see what's going on, you can run it in **Demo Mode** by adding ``--demo_mode`` on the command line, which pauses the browser briefly between actions, highlights page elements being acted on, and lets you know what test assertions are happening in real time:
140
+
If the example test is moving too fast for your eyes, you can run it in **Demo Mode** by adding ``--demo_mode`` on the command line, which pauses the browser briefly between actions, highlights page elements being acted on, and lets you know what test assertions are happening in real time:
215
141
216
142
```
217
143
pytest my_first_test.py --demo_mode
@@ -258,30 +184,7 @@ To run Pytest multithreaded on multiple CPUs at the same time, add ``-n=NUM`` or
258
184
259
185
If you want to pass additional data from the command line to your tests, you can use ``--data=STRING``. Now inside your tests, you can use ``self.data`` to access that.
### <imgsrc="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png"title="SeleniumBase"height="32"> **Using SeleniumBase from a [PyPI](https://pypi.org/) installation:**
264
-
265
-
You can install SeleniumBase without cloning the repo by doing this:
266
-
267
-
```
268
-
python -m pip install -U pip
269
-
pip install -U seleniumbase --no-cache-dir
270
-
```
271
-
272
-
You can then install webdrivers by doing this:
273
-
274
-
```
275
-
seleniumbase install chromedriver
276
-
seleniumbase install geckodriver
277
-
seleniumbase install edgedriver
278
-
seleniumbase install iedriver
279
-
seleniumbase install operadriver
280
-
```
281
-
282
-
(You'll need chromedriver if you want to run automation on Chrome, geckodriver if you want to run automation on Firefox, edgedriver for Microsoft Edge, etc.)
283
-
284
-
When creating your own test directories, keep these two things in mind:
For running tests outside of the SeleniumBase repo with **Pytest**, you'll want a copy of **[pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini)** on the root folder. For running tests outside of the SeleniumBase repo with **Nosetests**, you'll want a copy of **[setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg)** on the root folder. (Subfolders should include a blank ``__init__.py`` file.)
### <imgsrc="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png"title="SeleniumBase"height="32"> **Creating Visual Test Suite Reports:**
Copy file name to clipboardExpand all lines: examples/tour_examples/ReadMe.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,14 @@
1
1
## SeleniumBase Website Tours
2
2
3
-
SeleniumBase Tours utilize your choice of 4 different JavaScript libraries for creating & running tours, demos, and walkthroughs on any website: **[Shepherd](https://shipshapecode.github.io/shepherd/docs/welcome/)**, **[Bootstrap Tour](http://bootstraptour.com/)**, **[IntroJS](https://introjs.com/)**, and **[Hopscotch](http://linkedin.github.io/hopscotch/)**. Choose your favorite one to use!
3
+
SeleniumBase Tours utilize your choice of 4 different JavaScript libraries for prototyping tours, demos, walkthroughs, and onboarding experiences on any website: **[Shepherd](https://shipshapecode.github.io/shepherd/docs/welcome/)**, **[Bootstrap Tour](http://bootstraptour.com/)**, **[IntroJS](https://introjs.com/)**, and **[Hopscotch](http://linkedin.github.io/hopscotch/)**. Choose your favorite one to use!
4
4
5
5
Example tour:
6
6
7
+
```
8
+
cd examples/tour_examples
9
+
pytest google_tour.py
10
+
```
11
+
7
12
<imgsrc="https://cdn2.hubspot.net/hubfs/100006/google_tour_3.gif"title="SeleniumBase Tour of Google"height="260"><br>
0 commit comments