Skip to content

Commit cda29fb

Browse files
authored
Merge pull request #439 from seleniumbase/update-reqs-and-ad-blocking-and-methods
Update requirements, ad-blocking settings, and methods
2 parents abf269f + 1ac1072 commit cda29fb

File tree

8 files changed

+76
-58
lines changed

8 files changed

+76
-58
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb.png" title="SeleniumBase" height="48">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
1+
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb7.png" title="SeleniumBase" height="48">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

33
[<img src="https://img.shields.io/github/release/seleniumbase/SeleniumBase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/releases) [<img src="https://dev.azure.com/seleniumbase/seleniumbase/_apis/build/status/seleniumbase.SeleniumBase?branchName=master" alt=" " />](https://dev.azure.com/seleniumbase/seleniumbase/_build/latest?definitionId=1&branchName=master) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt=" " />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt=" " />](https://gitter.im/seleniumbase/SeleniumBase) [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/stargazers)
44

55
All-in-one framework for web automation, end-to-end testing, and website tours. SeleniumBase uses pytest for running Python scripts, while using Selenium WebDriver for controlling web browsers.
66

7+
<img src="https://cdn2.hubspot.net/hubfs/100006/images/my_first_test_gif.gif" title="SeleniumBase"><br />
8+
(<i>Above: [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) from [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) in Demo Mode.</i>)<br />
9+
```
10+
pytest my_first_test.py --demo
11+
```
12+
713
* Contains reliable, smart-waiting code to prevent flaky tests.
814
* Simplifies the process of creating UI tests for any website.
915
* Includes [Plugins](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py) for logging [test results and screenshots](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md).
@@ -14,12 +20,6 @@ All-in-one framework for web automation, end-to-end testing, and website tours.
1420
* Supports [Azure Pipelines](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/azure_pipelines/ReadMe.md), [GCP](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md), [TravisCI](https://github.com/seleniumbase/SeleniumBase/blob/master/.travis.yml), [Docker](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/docker/ReadMe.md), and more.
1521
* To see the full list of SeleniumBase features, [click here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md).
1622

17-
<img src="https://cdn2.hubspot.net/hubfs/100006/images/my_first_test_gif.gif" title="SeleniumBase"><br />
18-
(<i>Above: [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) from [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) in Demo Mode.</i>)<br />
19-
```
20-
pytest my_first_test.py --demo
21-
```
22-
2323
## <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Get Started:
2424

2525
You'll need **[Python](https://www.python.org/downloads/)** on your System PATH. [<img src="https://img.shields.io/badge/python-2.7,_3.5+-22AADD.svg" alt="Python versions" />](https://www.python.org/downloads/)
@@ -297,7 +297,7 @@ nosetests test_suite.py --report
297297
```
298298
<img src="https://cdn2.hubspot.net/hubfs/100006/images/Test_Report_2.png" title="Example Nosetest Report" height="420">
299299

300-
(NOTE: You can add ``--show_report`` to immediately display Nosetest reports after the test suite completes. Only use ``--show_report`` when running tests locally because it pauses the test run.)
300+
(NOTE: You can add ``--show-report`` to immediately display Nosetest reports after the test suite completes. Only use ``--show-report`` when running tests locally because it pauses the test run.)
301301

302302

303303
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> **Using a Proxy Server:**
@@ -349,7 +349,7 @@ Here are some things you can do to setup a production environment for your testi
349349
* If you use [Slack](https://slack.com), you can easily have your Jenkins jobs display results there by using the [Jenkins Slack Plugin](https://github.com/jenkinsci/slack-plugin). Another way to send messages from your tests to Slack is by using [Slack's Incoming Webhooks API](https://api.slack.com/incoming-webhooks).
350350

351351
<a id="amazon_section"></a>
352-
* If you're using AWS, you can setup an [Amazon S3](https://aws.amazon.com/s3/) account for saving your log files and screenshots for future viewing. SeleniumBase already has [all the code you need to connect to S3](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/s3_logging_plugin.py). You'll need to modify [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) with connection details to your instance and the location in S3 where you want log files to be saved. You'll also need to add "``--with-s3_logging``" on the command-line when you run your tests.
352+
* If you're using AWS, you can setup an [Amazon S3](https://aws.amazon.com/s3/) account for saving your log files and screenshots for future viewing. SeleniumBase already has [all the code you need to connect to S3](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/s3_logging_plugin.py). You'll need to modify [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) with connection details to your instance and the location in S3 where you want log files to be saved. You'll also need to add "``--with-s3-logging``" on the command-line when you run your tests.
353353

354354
Here's an example of running tests with additional features enabled:
355355
```bash

examples/upload_file_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ class FileUploadButtonTests(BaseCase):
88
def test_file_upload_button(self):
99
self.open("https://www.w3schools.com/jsref/tryit.asp"
1010
"?filename=tryjsref_fileupload_get")
11-
self.wait_for_element('[id*="google_ads"]')
12-
self.remove_elements('[id*="google_ads"]')
11+
if not self.ad_block_on:
12+
# If ad-blocking is disabled, block anyway.
13+
self.wait_for_element('[id*="google_ads"]')
14+
self.remove_elements('[id*="google_ads"]')
1315
self.switch_to_frame('iframeResult')
1416
self.add_css_style(
1517
'input[type="file"]{zoom: 1.5;-moz-transform: scale(1.5);}')

help_docs/features_list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb4.png" title="SeleniumBase" height="48">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
1+
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb.png" title="SeleniumBase" height="48">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

33
<a id="feature_list"></a>
44
## <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> **Features:**

help_docs/method_summary.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ self.wait_for_ready_state_complete(timeout=None)
173173

174174
self.wait_for_angularjs(timeout=None)
175175

176+
self.sleep(seconds)
177+
176178
self.activate_jquery()
177179

178180
self.bring_to_front(selector, by=By.CSS_SELECTOR)

requirements.txt

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ pip>=19.3.1
22
setuptools>=42.0.2
33
setuptools-scm>=3.3.3
44
wheel>=0.33.6
5-
six>=1.13.0
6-
nose>=1.3.7
7-
ipdb>=0.12.2
5+
six==1.13.0
6+
nose==1.3.7
7+
ipdb==0.12.3
88
idna==2.8
99
chardet==3.0.4
10-
urllib3==1.25.6
11-
requests>=2.22.0
10+
urllib3==1.25.7
11+
requests==2.22.0
1212
selenium==3.141.0
1313
pluggy>=0.13.1
1414
attrs>=19.3.0
15-
pytest>=4.6.6;python_version<"3"
15+
pytest>=4.6.7;python_version<"3"
1616
pytest>=5.3.1;python_version>="3"
1717
pytest-cov>=2.8.1
1818
pytest-forked>=1.1.3
@@ -24,19 +24,20 @@ pytest-rerunfailures>=8.0
2424
pytest-timeout>=1.3.3
2525
pytest-xdist>=1.30.0
2626
parameterized>=0.7.1
27-
beautifulsoup4>=4.6.0
28-
atomicwrites>=1.3.0
29-
portalocker>=1.5.2
30-
cryptography>=2.8
31-
asn1crypto>=1.2.0
32-
pyopenssl>=19.1.0
33-
pygments>=2.5.2
34-
colorama>=0.4.1
35-
pymysql>=0.9.3
36-
pyotp>=2.3.0
37-
boto>=2.49.0
27+
soupsieve==1.9.5
28+
beautifulsoup4==4.8.1
29+
atomicwrites==1.3.0
30+
portalocker==1.5.2
31+
cryptography==2.8
32+
asn1crypto==1.2.0
33+
pyopenssl==19.1.0
34+
pygments==2.5.2
35+
colorama==0.4.1
36+
pymysql==0.9.3
37+
pyotp==2.3.0
38+
boto==2.49.0
3839
cffi>=1.13.2
39-
tqdm>=4.40.0
40-
flake8>=3.7.9
40+
tqdm>=4.40.1
41+
flake8==3.7.9
4142
certifi>=2019.11.28
4243
pdfminer.six==20191110

seleniumbase/config/ad_block_list.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,21 @@
1717
"""
1818

1919
AD_BLOCK_LIST = [
20+
'script[src*="/adservice."]',
21+
'script[type="data-doubleclick"]',
22+
'script[src*="doubleclick.net"]',
23+
'script[src*="googletagservices.com/"]',
24+
'script[src*="ad.doubleclick.net/"]',
25+
'script[src*="adsbygoogle.js"]',
26+
'script[src*="adroll.com"]',
27+
'script[src*="/pagead/"]',
28+
'iframe[onload*="doWithAds"]',
29+
'iframe[src*="doubleclick.net"]',
30+
'iframe[id*="google_ads_frame"]',
2031
'[aria-label="Ad"]',
2132
'[class^="sponsored-content"]',
33+
'[class="adsbygoogle"]',
34+
'[class^="adroll"]',
2235
'[data-ad-details*="Advertisement"]',
2336
'[data-native_ad*="placement"]',
2437
'[data-provider="dianomi"]',
@@ -28,27 +41,27 @@
2841
'[data-ad-feedback-beacon]',
2942
'[href*="doubleclick.net/"]',
3043
'[href*="amazon-adsystem"]',
44+
'[alt="Advertisement"]',
3145
'[id*="-ad-"]',
3246
'[id*="_ads_"]',
33-
'[alt="Advertisement"]',
3447
'[id*="AdFrame"]',
3548
'[id*="carbonads"]',
3649
'[id^="ad-"]',
3750
'[id^="my-ads"]',
3851
'[id^="outbrain_widget"]',
3952
'[id^="taboola-"]',
53+
'[id^="google_ads_frame"]',
4054
'[id="dianomiRightRail"]',
4155
'[src*="smartads."]',
4256
'[src*="ad_nexus"]',
4357
'[src*="/ads/"]',
58+
'[allow*="advertising.com"]',
4459
'[data-dcm-click-tracker*="/adclick."]',
4560
'[data-google-query-id^="C"]',
46-
'[allow*="advertising.com"]',
4761
'[data-ylk*="pkgt:sponsored_cluster"]',
62+
'[data-google-av-cxn*="pagead2"]',
63+
'[data-ad-client]',
4864
'[data-ad-slot]',
49-
'iframe[onload*="doWithAds"]',
50-
'iframe[src*="doubleclick.net"]',
51-
'iframe[id*="google_ads_frame"]',
5265
'ins.adsbygoogle',
5366
'li.strm-ad-clusters',
5467
'li.js-stream-ad',
@@ -57,19 +70,15 @@
5770
'div.ad_module',
5871
'div.ad-subnav-container',
5972
'div.ad-wrapper',
73+
'div.adroll-block',
6074
'div.data-ad-container',
75+
'div.GoogleActiveViewElement',
6176
'div.l-ad',
6277
'div.right-ad',
6378
'div.wx-adWrapper',
6479
'div.image > a > img[src*="HomepageAd-"]',
6580
'img[src*="HomepageAd-"]',
6681
'img.img_ad',
6782
'link[href*="/adservice."]',
68-
'script[src*="/adservice."]',
69-
'script[type="data-doubleclick"]',
70-
'script[src*="doubleclick.net"]',
71-
'script[src*="googletagservices.com/"]',
72-
'script[src*="ad.doubleclick.net/"]',
73-
'script[src*="/pagead/"]',
7483
'section.dianomi-ad',
7584
]

seleniumbase/fixtures/base_case.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,9 @@ def wait_for_angularjs(self, timeout=None, **kwargs):
16081608
timeout = self.__get_new_timeout(timeout)
16091609
js_utils.wait_for_angularjs(self.driver, timeout, **kwargs)
16101610

1611+
def sleep(self, seconds):
1612+
time.sleep(seconds)
1613+
16111614
def activate_jquery(self):
16121615
""" If "jQuery is not defined", use this method to activate it for use.
16131616
This happens because jQuery is not always defined on web sites. """

setup.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
setup(
4747
name='seleniumbase',
48-
version='1.33.9',
48+
version='1.33.10',
4949
description='Fast, Easy, and Reliable Browser Automation & Testing.',
5050
long_description=long_description,
5151
long_description_content_type='text/markdown',
@@ -90,12 +90,12 @@
9090
'ipdb',
9191
'idna==2.8', # Must stay in sync with "requests"
9292
'chardet==3.0.4', # Must stay in sync with "requests"
93-
'urllib3==1.25.6', # Must stay in sync with "requests"
94-
'requests>=2.22.0',
93+
'urllib3==1.25.7', # Must stay in sync with "requests"
94+
'requests==2.22.0',
9595
'selenium==3.141.0',
9696
'pluggy>=0.13.1',
9797
'attrs>=19.3.0',
98-
'pytest>=4.6.6;python_version<"3"', # For Python 2 compatibility
98+
'pytest>=4.6.7;python_version<"3"', # For Python 2 compatibility
9999
'pytest>=5.3.1;python_version>="3"',
100100
'pytest-cov>=2.8.1',
101101
'pytest-forked>=1.1.3',
@@ -107,20 +107,21 @@
107107
'pytest-timeout>=1.3.3',
108108
'pytest-xdist>=1.30.0',
109109
'parameterized>=0.7.1',
110-
'beautifulsoup4>=4.6.0', # Keep at >=4.6.0 while using "bs4"
111-
'atomicwrites>=1.3.0',
112-
'portalocker>=1.5.2',
113-
'cryptography>=2.8',
114-
'asn1crypto>=1.2.0',
115-
'pyopenssl>=19.1.0',
110+
'soupsieve==1.9.5',
111+
'beautifulsoup4==4.8.1',
112+
'atomicwrites==1.3.0',
113+
'portalocker==1.5.2',
114+
'cryptography==2.8',
115+
'asn1crypto==1.2.0',
116+
'pyopenssl==19.1.0',
116117
'pygments>=2.5.2',
117-
'colorama>=0.4.1',
118-
'pymysql>=0.9.3',
119-
'pyotp>=2.3.0',
120-
'boto>=2.49.0',
118+
'colorama==0.4.1',
119+
'pymysql==0.9.3',
120+
'pyotp==2.3.0',
121+
'boto==2.49.0',
121122
'cffi>=1.13.2',
122-
'tqdm>=4.40.0',
123-
'flake8>=3.7.9',
123+
'tqdm>=4.40.1',
124+
'flake8==3.7.9',
124125
'certifi>=2019.11.28',
125126
'pdfminer.six==20191110',
126127
],

0 commit comments

Comments
 (0)