6
6
<link rel =" icon " href =" https://seleniumbase.io/img/logo6.png " />
7
7
8
8
<p align =" center " ><a href =" https://github.com/seleniumbase/SeleniumBase/ " >
9
- <img src =" https://seleniumbase.io/cdn/img/sb_logo_gs.png " alt =" SeleniumBase " title =" SeleniumBase " width =" 500 " /></a ></p >
9
+ <img src =" https://seleniumbase.io/cdn/img/sb_logo_gs.png " alt =" SeleniumBase " title =" SeleniumBase " width =" 450 " /></a ></p >
10
10
<p align =" center " ><a href =" https://github.com/seleniumbase/SeleniumBase/releases " >
11
- <img src =" https://img.shields.io/github/v/release/seleniumbase/SeleniumBase.svg?color=00a0c0 " alt =" Latest Release on GitHub " /></a > <a href =" https://pypi.org/project/seleniumbase/ " >
11
+ <img src =" https://img.shields.io/github/v/release/seleniumbase/SeleniumBase.svg?color=0090c0 " alt =" Latest Release on GitHub " /></a > <a href =" https://pypi.org/project/seleniumbase/ " >
12
12
<img src =" https://img.shields.io/pypi/v/seleniumbase.svg?color=00a0e0 " alt =" Latest Release on PyPI " /></a ></p >
13
13
<p align =" center " >
14
- <b >End -to-end testing for the next generation .</b >
14
+ <b >A complete end -to-end testing experience .</b >
15
15
</p >
16
16
17
17
<!-- View on GitHub -->
21
21
<img src =" https://img.shields.io/badge/docs-%20seleniumbase.io-22BBAA.svg " alt =" SeleniumBase.io Docs " /></a ></p >
22
22
23
23
<p >
24
- SeleniumBase is a Python framework for fast and reliable web automation and testing.
25
- Tests are run with "pytest". Browsers are controlled by WebDriver .
24
+ SeleniumBase is an all-in-one Python framework for automated browser testing.
25
+ Tests are run with "pytest", and use WebDriver APIs for web-page interaction .
26
26
</p >
27
27
28
28
<p align =" center " >
29
29
<a href =" #python_installation " >🚀 Start</a > |
30
30
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md " >🗂️ Features</a > |
31
31
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md " >🖥️ CLI</a > |
32
- <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md " >📖 Examples</a > |
32
+ <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md " >📖 Examples</a >
33
+ <br />
33
34
<a href =" https://github.com/seleniumbase/SeleniumBase/tree/master/examples/boilerplates " >♻️ Boilerplates</a > |
34
35
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/locale_codes.md " >🗾 Locales</a > |
35
36
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/js_package_manager.md " >🗄️ PkgManager</a >
36
37
<br />
37
38
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md " >📗 API</a > |
38
39
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md " >📋 Reports</a > |
39
40
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/console_scripts/ReadMe.md " >💻 Scripts</a > |
40
- <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mobile_testing.md " >📱 Mobile</a > |
41
- <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md " >🔡 Syntax Formats</a > |
42
- <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md " >🌐 Grid Hub</a > |
41
+ <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mobile_testing.md " >📱 Mobile</a >
42
+ <br />
43
+ <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md " >🔡 SyntaxFormats</a > |
44
+ <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md " >🌐 GridHub</a > |
43
45
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_ide/ReadMe.md " >⏺️ Recorder</a >
44
46
<br />
45
47
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/github/workflows/ReadMe.md " >🤖 CI</a > |
46
48
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/translations.md " >🌏 Translate</a > |
47
49
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md " >🗺️ Tours</a > |
48
- <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md " >🖼️ VisualTest</a > |
50
+ <a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md " >🖼️ VisualTest</a >
51
+ <br />
49
52
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/ReadMe.md " >📑 Presenter</a > |
50
53
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/ReadMe.md " >📊 ChartMaker</a > |
51
54
<a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md " >🛂 MasterQA</a >
52
55
</p >
53
56
54
- ✅ Fast setup: All you need is [ Python] ( https://www.python.org/downloads/ ) ! 🐍<br />
55
- ✅ Includes [ reporting & dashboard tools] ( https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md ) .<br />
57
+ ✅ Simple setup steps with [ Python] ( https://www.python.org/downloads/ ) and [ Git] ( https://git-scm.com/ ) .<br />
58
+ ✅ Chrome/Edge/Firefox/IE/Opera/Safari.<br />
59
+ ✅ Includes [ reporting and dashboard tools] ( https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md ) .
56
60
57
61
--------
58
62
@@ -64,6 +68,29 @@ pytest my_first_test.py --demo
64
68
65
69
<p align =" left " ><a href =" https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py " ><img src =" https://seleniumbase.io/cdn/gif/my_first_test_4.gif " alt =" SeleniumBase Demo Mode " title =" SeleniumBase Demo Mode " /></a ></p >
66
70
71
+ ``` python
72
+ from seleniumbase import BaseCase
73
+
74
+ class MyTestClass (BaseCase ):
75
+
76
+ def test_basics (self ):
77
+ url = " https://store.xkcd.com/collections/posters"
78
+ self .open(url)
79
+ self .type(' input[name="q"]' , " xkcd book" )
80
+ self .click(' input[value="Search"]' )
81
+ self .assert_text(" xkcd: volume 0" , " h3" )
82
+ self .open(" https://xkcd.com/353/" )
83
+ self .assert_title(" xkcd: Python" )
84
+ self .assert_element(' img[alt="Python"]' )
85
+ self .click(' a[rel="license"]' )
86
+ self .assert_text(" free to copy and reuse" )
87
+ self .go_back()
88
+ self .click_link(" About" )
89
+ self .assert_exact_text(" xkcd.com" , " h2" )
90
+ ```
91
+
92
+ --------
93
+
67
94
<a id =" python_installation " ></a >
68
95
<h2 ><img src =" https://seleniumbase.io/img/logo6.png " title =" SeleniumBase " width =" 32 " /> Python Setup:</h2 >
69
96
@@ -182,32 +209,9 @@ pytest my_first_test.py --demo
182
209
183
210
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py"><img src="https://seleniumbase.io/cdn/gif/my_first_test_4.gif" alt="SeleniumBase Demo Mode" title="SeleniumBase Demo Mode" /></a>
184
211
185
- <b>Here' s the code for [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py):< /b>
186
-
187
- ` ` ` python
188
- from seleniumbase import BaseCase
189
-
190
- class MyTestClass(BaseCase):
191
-
192
- def test_basics(self):
193
- url = " https://store.xkcd.com/collections/posters"
194
- self.open(url)
195
- self.type(' input[name="q"]' , " xkcd book" )
196
- self.click(' input[value="Search"]' )
197
- self.assert_text(" xkcd: volume 0" , " h3" )
198
- self.open(" https://xkcd.com/353/" )
199
- self.assert_title(" xkcd: Python" )
200
- self.assert_element(' img[alt="Python"]' )
201
- self.click(' a[rel="license"]' )
202
- self.assert_text(" free to copy and reuse" )
203
- self.go_back ()
204
- self.click_link(" About" )
205
- self.assert_exact_text(" xkcd.com" , " h2" )
206
- ` ` `
207
-
208
212
* By default, **[CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp)** are used for finding page elements.
209
213
* If you' re new to CSS Selectors, games like [Flukeout](http://flukeout.github.io/) can help you learn.
210
- * Here are some common ``SeleniumBase`` methods you might find in tests:
214
+ * Here are some common ` ` SeleniumBase` ` methods that you might find in tests:
211
215
212
216
` ` ` python
213
217
self.open(URL) # Navigate to the web page
@@ -426,23 +430,28 @@ sbase mkdir ui_tests
426
430
427
431
```bash
428
432
ui_tests/
433
+ │
429
434
├── __init__.py
430
- ├── boilerplates/
431
- │ ├── __init__.py
432
- │ ├── base_test_case.py
433
- │ ├── boilerplate_test.py
434
- │ ├── classic_obj_test.py
435
- │ ├── page_objects.py
436
- │ └── samples/
437
- │ ├── __init__.py
438
- │ ├── google_objects.py
439
- │ └── google_test.py
440
435
├── my_first_test.py
441
436
├── parameterized_test.py
442
437
├── pytest.ini
443
438
├── requirements.txt
444
439
├── setup.cfg
445
- └── test_demo_site.py
440
+ ├── test_demo_site.py
441
+ └── boilerplates/
442
+ │
443
+ ├── __init__.py
444
+ ├── base_test_case.py
445
+ ├── boilerplate_test.py
446
+ ├── classic_obj_test.py
447
+ ├── page_objects.py
448
+ ├── sb_fixture_test.py
449
+ └── samples/
450
+ │
451
+ ├── __init__.py
452
+ ├── google_objects.py
453
+ ├── google_test.py
454
+ └── swag_labs_test.py
446
455
```
447
456
448
457
<b>ProTip™:</b> You can also create a boilerplate folder without any sample tests in it by adding ``-b`` or ``--basic`` to the ``sbase mkdir`` command:
@@ -455,6 +464,7 @@ sbase mkdir ui_tests --basic
455
464
456
465
```bash
457
466
ui_tests/
467
+ │
458
468
├── __init__.py
459
469
├── pytest.ini
460
470
├── requirements.txt
@@ -790,22 +800,24 @@ is_text_visible(text, selector) # is text visible on a page
790
800
` ` ` python
791
801
def get_mirror_universe_captain_picard_superbowl_ad(superbowl_year):
792
802
selector = " div.superbowl_%s div.commercials div.transcript div.picard" % superbowl_year
793
- if self.is_text_visible(" For the Love of Marketing and Earl Grey Tea!" , selector):
794
- return " Picard HubSpot Superbowl Ad 2015"
803
+ if self.is_text_visible(" Yes, it was I who summoned you all here." , selector):
804
+ return " Picard Paramount+ Superbowl Ad 2020"
805
+ elif self.is_text_visible(" For the Love of Marketing and Earl Grey Tea!" , selector):
806
+ return " Picard Mirror Universe HubSpot Superbowl Ad 2015"
795
807
elif self.is_text_visible(" Delivery Drones... Engage" , selector):
796
- return " Picard Amazon Superbowl Ad 2015"
808
+ return " Picard Mirror Universe Amazon Superbowl Ad 2015"
797
809
elif self.is_text_visible(" Bing it on Screen!" , selector):
798
- return " Picard Microsoft Superbowl Ad 2015"
810
+ return " Picard Mirror Universe Microsoft Superbowl Ad 2015"
799
811
elif self.is_text_visible(" OK Glass, Make it So!" , selector):
800
- return " Picard Google Superbowl Ad 2015"
812
+ return " Picard Mirror Universe Google Superbowl Ad 2015"
801
813
elif self.is_text_visible(" Number One, I've Never Seen Anything Like It." , selector):
802
- return " Picard Tesla Superbowl Ad 2015"
814
+ return " Picard Mirror Universe Tesla Superbowl Ad 2015"
803
815
elif self.is_text_visible(" " " With the first link, the chain is forged.
804
816
The first speech censored, the first thought forbidden,
805
817
the first freedom denied, chains us all irrevocably." " " , selector):
806
- return " Picard Wikimedia Superbowl Ad 2015"
818
+ return " Picard Mirror Universe Wikimedia Superbowl Ad 2015"
807
819
elif self.is_text_visible(" Let us make sure history never forgets the name ... Facebook" , selector):
808
- return " Picard Facebook Superbowl Ad 2015"
820
+ return " Picard Mirror Universe Facebook Superbowl Ad 2015"
809
821
else:
810
822
raise Exception(" Reports of my assimilation are greatly exaggerated." )
811
823
` ` `
0 commit comments