Skip to content

Commit 8173611

Browse files
authored
Merge pull request #849 from seleniumbase/the-big-refactor
Lots of refactoring and efficiency improvements
2 parents 879e6a1 + 9b0f423 commit 8173611

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+208
-1591
lines changed

examples/master_qa/ReadMe.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
![](https://cdn2.hubspot.net/hubfs/100006/images/masterqa_logo-11.png "MasterQA")
1+
![](https://seleniumbase.io/cdn/img/masterqa_logo.png "MasterQA")
22

3-
### MasterQA combines automation with manual verification steps.
3+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> MasterQA combines automation with manual verification steps.</h3>
44

5-
![](https://cdn2.hubspot.net/hubfs/100006/images/masterqa6.gif "MasterQA")
5+
![](https://seleniumbase.io/cdn/gif/masterqa6.gif "MasterQA")
66

77
Here's example code from [basic_masterqa_test_0.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/basic_masterqa_test_0.py):
88

@@ -19,16 +19,16 @@ After each automation checkpoint, a pop-up window will ask the user questions fo
1919

2020
When the test run completes, as seen from [this longer example](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/masterqa_test_1.py), you'll reach the results page that appears after answering all the verification questions. (Failed verifications generate links to screenshots and log files.)
2121

22-
![](https://cdn2.hubspot.net/hubfs/100006/images/hybrid_screen.png "MasterQA")
22+
![](https://seleniumbase.io/cdn/img/mqa_hybrid.png "MasterQA")
2323

2424
You may have noticed the ``Incomplete Test Runs`` row on the results page. If the value for that is not zero, it means that one of the automated steps failed. This could happen if you tell your script to perform an action on an element that doesn't exist. Now that we're mixing automation with manual QA, it's good to tell apart the failures from each. The results_table CSV file contains a spreadsheet with the details of each failure (if any) for both manual and automated steps.
2525

2626
#### How to run the example tests from scratch:
27+
2728
```bash
2829
git clone https://github.com/seleniumbase/SeleniumBase.git
2930
cd SeleniumBase
30-
pip install -r requirements.txt --upgrade
31-
python setup.py develop
31+
pip install .
3232
cd examples/master_qa
3333
pytest basic_masterqa_test_0.py
3434
pytest masterqa_test_1.py
@@ -48,6 +48,6 @@ self.verify()
4848
self.verify("Can you find the moon?")
4949
```
5050

51-
---
51+
--------
5252

5353
MasterQA is powered by [SeleniumBase](https://seleniumbase.com), the most advanced open-source automation framework on the [Planet](https://en.wikipedia.org/wiki/Earth).

examples/test_chromedriver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def test_chromedriver_matches_chrome(self):
1313
print("\n This test is only for Chrome!")
1414
print(" (Run with: '--browser=chrome')")
1515
self.skip("This test is only for Chrome!")
16-
driver_capabilities = self.driver.__dict__["capabilities"]
16+
driver_capabilities = self.driver.capabilities
1717
if "version" in driver_capabilities:
1818
chrome_version = driver_capabilities["version"]
1919
else:
2020
chrome_version = driver_capabilities["browserVersion"]
2121
major_chrome_version = chrome_version.split('.')[0]
22-
chrome_dict = self.driver.__dict__["capabilities"]["chrome"]
22+
chrome_dict = self.driver.capabilities["chrome"]
2323
chromedriver_version = chrome_dict["chromedriverVersion"]
2424
chromedriver_version = chromedriver_version.split(' ')[0]
2525
major_chromedriver_version = chromedriver_version.split('.')[0]

examples/tour_examples/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="320" /></h3>
22

3-
## Interactive Product Tours
3+
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Interactive Product Tours</h2>
44

55
SeleniumBase Tours utilize 5 JavaScript libraries for creating interactive walkthroughs on any website:<br>**[Shepherd](https://shepherdjs.dev/)**, **[Bootstrap Tour](http://bootstraptour.com/)**, **[IntroJS](https://introjs.com/)**, **[DriverJS](https://kamranahmed.info/driver.js/)**, and **[Hopscotch](https://linkedinattic.github.io/hopscotch/)**.
66

help_docs/desired_capabilities.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Using Desired Capabilities</h3>
1+
<h3><img src="https://seleniumbase.io/img/logo6.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), [Sauce Labs](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/), or [TestingBot](https://testingbot.com/support/other/test-options).
44

help_docs/hidden_files_info.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Info about hidden files on macOS
1+
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Info about hidden files on macOS</h2>
22

33
Depending on your macOS settings, some files may be hidden from view in your Finder window, such as ``.gitignore``. To view all files, run the following command and then reopen the Finder window:
44

help_docs/how_it_works.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@
33
<a id="how_seleniumbase_works"></a>
44
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> How it works:</h2>
55

6-
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, 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 arguments](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.
6+
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), 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 arguments](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.
77

88
(NOTE: pytest uses a feature called test discovery to automatically find and run Python methods that start with "``test_``" from the file that you specified on the command line.)
99

10-
To use SeleniumBase calls you need the following:
10+
The most common way of using SeleniumBase is by inheriting BaseCase:
1111

1212
```python
1313
from seleniumbase import BaseCase
1414
```
1515

16-
And then have your test classes inherit BaseCase:
16+
Then have your test classes inherit BaseCase:
1717

1818
```python
1919
class MyTestClass(BaseCase):
2020
```
2121

2222
(See the example test, [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py), for reference.)
23+
24+
--------
25+
26+
For more ways of using SeleniumBase, see: <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md">SyntaxFormats</a>.

help_docs/html_inspector.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> The HTML Inspector</h2>
2+
3+
🔵 <b>HTML Inspector</b> provides useful info about a web page.
4+
5+
🔵 (<i>Based on: [github.com/philipwalton/html-inspector](https://github.com/philipwalton/html-inspector)</i>)
6+
7+
🔵 Example: [examples/test_inspect_html.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_inspect_html.py) (Chromium-only)
8+
9+
```python
10+
from seleniumbase import BaseCase
11+
12+
class HtmlInspectorTests(BaseCase):
13+
def test_html_inspector(self):
14+
self.open("https://xkcd.com/1144/")
15+
self.inspect_html()
16+
```
17+
18+
--------
19+
20+
```bash
21+
pytest test_inspect_html.py
22+
============== test session starts ==============
23+
24+
* HTML Inspection Results: https://xkcd.com/1144/
25+
X - https://xkcd.com/1144/ - Access to XMLHttpRequest at 'https://xkcd.com/usBanner' (redirected from 'https://c.xkcd.com/xkcd/news') from origin 'https://xkcd.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
26+
X - https://xkcd.com/usBanner - Failed to load resource: net::ERR_FAILED
27+
X - 'property' is not a valid attribute of the <meta> element.
28+
X - Do not use <div> or <span> elements without any attributes.
29+
X - The 'alt' attribute is required for <img> elements.
30+
X - The 'border' attribute is no longer valid on the <img> element and should not be used.
31+
X - 'srcset' is not a valid attribute of the <img> element.
32+
X - The <center> element is obsolete and should not be used.
33+
X - <script> elements should appear right before the closing </body> tag for optimal performance.
34+
X - The id 'comicLinks' appears more than once in the document.
35+
* (See the Console output for details!)
36+
```

help_docs/js_package_manager.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

3-
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> JS Package Manager</h2>
3+
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> JS Package Manager</h2>
44

55
<div>SeleniumBase lets you load JavaScript packages from any CDN link into any website.</div>
66
<p><div>Here's an example of loading a website-tour library into the browser while visiting Google:</div></p>
77

8-
<img src="https://cdn2.hubspot.net/hubfs/100006/google_tour_3.gif" title="SeleniumBase Tour of Google" /><br />
8+
<img src="https://seleniumbase.io/cdn/gif/driverjs_tour.gif" title="SeleniumBase Tour of Google" /><br />
99

1010
This example, ([google_tour.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/google_tour.py) from the SeleniumBase ``examples/tour_examples/`` folder), can be run with ``pytest`` after you've cloned and installed [SeleniumBase from GitHub](https://github.com/seleniumbase/SeleniumBase):
1111

@@ -82,7 +82,7 @@ def add_css_link(driver, css_link):
8282
<div>Website tours are just one of the many ways of using the SeleniumBase JS Package Manager.</div>
8383
<p><div>The following example shows the <a href="https://github.com/craftpip/jquery-confirm">JqueryConfirm</a> package loaded into a website for creating fancy dialog boxes:</div></p>
8484

85-
<img src="https://cdn2.hubspot.net/hubfs/100006/images/masterqa6.gif" alt="MasterQA by SeleniumBase" title="MasterQA by SeleniumBase" /><br />
85+
<img src="https://seleniumbase.io/cdn/gif/masterqa6.gif" alt="MasterQA by SeleniumBase" title="MasterQA by SeleniumBase" /><br />
8686

8787
<p><div>(Example from <a href="https://seleniumbase.io/examples/master_qa/ReadMe/">SeleniumBase's MasterQA ReadMe</a>)</div></p>
8888

help_docs/locale_codes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="24" /> Language Locale Codes</h2>
1+
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="25" /> Language Locale Codes</h2>
22

33
You can specify a Language Locale Code to customize web pages on supported websites. With SeleniumBase you can change the web browser's Locale on the command line by adding:
44

55
```bash
66
--locale=CODE # Example: --locale=ru
77
```
88

9-
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="24" /> List of Language Locale Codes:</h3>
9+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="25" /> List of Language Locale Codes:</h3>
1010

1111
<table>
1212
<thead><tr><th>Language</th><th>Code</th></tr></thead>

help_docs/mysql_installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### MySQL Installation Instructions
1+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="25" /> MySQL Installation Instructions</h3>
22

33

44
#### [MySQL](http://www.mysql.com/) (OPTIONAL)

0 commit comments

Comments
 (0)