Skip to content

Commit 819e064

Browse files
authored
Merge pull request #1690 from seleniumbase/dependencies-and-refactoring
Dependencies and Refactoring
2 parents ab0f597 + 0bd618b commit 819e064

30 files changed

+269
-317
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,17 @@ class CoffeeCartTest(BaseCase):
9999

100100
<p>💡 SeleniumBase methods often perform multiple actions in a single method call. For example, <code>self.type(selector,text)</code> does the following:<br />1. Waits for the element to be visible.<br />2. Waits for the element to be interactive.<br />3. Clears the text field.<br />4. Types in the new text.<br />5. Presses Enter/Submit if the text ends in "\n".<br />With raw Selenium, those actions require multiple method calls.</p>
101101

102-
<p>💡 SeleniumBase uses default timeout values when not set, which means that methods automatically wait for elements to appear (<i>up to the timeout limit</i>) before failing:<br />✅<code>self.click("button")</code><br />With raw Selenium, methods would fail instantly (<i>by default</i>) if an element needed more time to load:<br />❌<code>self.driver.find_element(by="css selector", value="button").click()</code><br />(Reliable code is better than unreliable code.)</p>
103-
104-
<p>💡 SeleniumBase lets you change the explicit timeout values of methods:<br />✅<code>self.click("button",timeout=10)</code><br />With raw Selenium, that requires more code:<br />❌<code>WebDriverWait(driver,10).until(EC.element_to_be_clickable("css selector", "button")).click()</code><br />(Simple code is better than complex code.)</p>
102+
<p>💡 SeleniumBase uses default timeout values when not set:<br />
103+
✅<code>self.click("button")</code><br />
104+
With raw Selenium, methods would fail instantly (<i>by default</i>) if an element needed more time to load:<br />
105+
❌<code>self.driver.find_element(by="css selector", value="button").click()</code><br />
106+
(Reliable code is better than unreliable code.)</p>
107+
108+
<p>💡 SeleniumBase lets you change the explicit timeout values of methods:<br />
109+
✅<code>self.click("button",timeout=10)</code><br />
110+
With raw Selenium, that requires more code:<br />
111+
❌<code>WebDriverWait(driver,10).until(EC.element_to_be_clickable("css selector", "button")).click()</code><br />
112+
(Simple code is better than complex code.)</p>
105113

106114
<p>💡 SeleniumBase gives you clean error output when a test fails. With raw Selenium, error messages can get very messy.</p>
107115

@@ -1184,13 +1192,16 @@ pytest --reruns=1 --reruns-delay=1
11841192
</p>
11851193
<p><div><a href="https://github.com/mdmintz">https://github.com/mdmintz</a></div></p>
11861194
1187-
<div><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/fancy_logo_14.png" title="SeleniumBase" width="220" /></a></div> <div><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" title="SeleniumBase" /></a> <a href="https://gitter.im/seleniumbase/SeleniumBase" target="_blank"><img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" title="SeleniumBase" alt="Join the chat!" /></a></div> <div><a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://img.shields.io/badge/tested%20with-SeleniumBase-04C38E.svg" alt="Tested with SeleniumBase" /></a></div> <div><a href="https://seleniumbase.io"><img src="https://img.shields.io/badge/docs-seleniumbase.io-11BBAA.svg" alt="SeleniumBase Docs" /></a></div> <div><a href="https://pepy.tech/project/seleniumbase" target="_blank"><img src="https://pepy.tech/badge/seleniumbase" alt="SeleniumBase PyPI downloads" /></a></div>
1195+
<div><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/fancy_logo_14.png" title="SeleniumBase" width="220" /></a></div> <div><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" title="SeleniumBase" /></a> <a href="https://gitter.im/seleniumbase/SeleniumBase" target="_blank"><img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" title="SeleniumBase" alt="Join the chat!" /></a></div> <div><a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://img.shields.io/badge/tested%20with-SeleniumBase-04C38E.svg" alt="Tested with SeleniumBase" /></a></div> <div><a href="https://seleniumbase.io"><img src="https://img.shields.io/badge/docs-seleniumbase.io-11BBAA.svg" alt="SeleniumBase Docs" /></a></div>
11881196
11891197
<p><div>
11901198
<span><a href="https://www.youtube.com/playlist?list=PLp9uKicxkBc5UIlGi2BuE3aWC7JyXpD3m"><img src="https://seleniumbase.github.io/cdn/img/youtube.png" title="SeleniumBase Playlist on YouTube" alt="SeleniumBase Playlist on YouTube" width="54" /></a></span>
11911199
<span><a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://seleniumbase.github.io/img/social/share_github.svg" title="SeleniumBase on GitHub" alt="SeleniumBase on GitHub" width="50" /></a></span>
11921200
<span><a href="https://gitter.im/seleniumbase/SeleniumBase" target="_blank"><img src="https://seleniumbase.github.io/img/social/share_gitter.svg" title="SeleniumBase on Gitter" alt="SeleniumBase on Gitter" width="38" /></a></span>
11931201
</div></p>
11941202
1203+
--------
1204+
11951205
<p><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" title="SeleniumBase" width="240" /></a></p>
1206+
<p><a href="https://pepy.tech/project/seleniumbase" target="_blank"><img src="https://pepy.tech/badge/seleniumbase" alt="SeleniumBase PyPI downloads" /></a></p>
11961207
<p><a href="https://www.python.org/downloads/" target="_blank"><img src="https://img.shields.io/pypi/pyversions/seleniumbase.svg?color=22AAEE&logo=python&logoColor=FEDC54" title="Supported Python Versions" /></a></p>

examples/basic_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def test_basics(self):
1919
self.assert_element("div#login_button_container")
2020

2121

22-
if __name__ == "__main__":
22+
if __name__ == "__main__": # If "python" called
2323
from pytest import main
24-
main([__file__, "-s"])
24+
from sys import argv
25+
main([*argv, "-s"]) # Run pytest, same args

examples/gui_test_runner.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
"""
2-
GUI TEST RUNNER
1+
"""GUI TEST RUNNER
32
Run by Typing: "python gui_test_runner.py"
4-
(Use Python 3 - There are GUI issues when using Python 2)
5-
"""
6-
3+
(Use Python 3)"""
74
import subprocess
8-
import sys
9-
10-
if sys.version_info[0] >= 3:
11-
from tkinter import Tk, Frame, Button, Label
12-
else:
13-
from Tkinter import Tk, Frame, Button, Label
5+
from tkinter import Tk, Frame, Button, Label
146

157

168
class App:

examples/parameterized_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from parameterized import parameterized
22
from seleniumbase import BaseCase
3+
BaseCase.main(__name__, __file__)
34

45

56
class GoogleTests(BaseCase):

examples/test_event_firing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
""" Testing EventFiringWebDriver with AbstractEventListener """
2-
32
from selenium.webdriver.support.events import EventFiringWebDriver
43
from selenium.webdriver.support.events import AbstractEventListener
54
from seleniumbase import BaseCase
5+
BaseCase.main(__name__, __file__)
66

77

88
class MyListener(AbstractEventListener):

examples/test_get_locale_code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from seleniumbase import BaseCase
2+
BaseCase.main(__name__, __file__)
23

34

45
class LocaleTests(BaseCase):

examples/test_show_file_choosers.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
"""
2-
self.show_file_choosers() is used to show hidden file-upload fields.
3-
Verify that one can choose a file after the hidden input is visible.
4-
"""
1+
"""self.show_file_choosers() is used to show hidden file-upload fields.
2+
Verify that one can choose a file after the hidden input is visible."""
53
import os
64
from seleniumbase import BaseCase
75
BaseCase.main(__name__, __file__)

examples/test_skype_site.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
This is a mobile device test for Chromium-based browsers (such as MS Edge)
3-
Usage: pytest test_skype_site.py --mobile --browser=edge
3+
Usage: pytest test_skype_site.py --mobile --edge
44
55
Default mobile settings for User Agent and Device Metrics if not specified:
66
User Agent: --agent="Mozilla/5.0 (Linux; Android 11; Pixel 4 XL)"
@@ -27,3 +27,8 @@ def test_skype_mobile_site(self):
2727
self.highlight("#get-skype-0_android-download")
2828
self.highlight('[data-bi-id*="ios"]')
2929
self.highlight('[data-bi-id*="windows10"]')
30+
31+
32+
if __name__ == "__main__":
33+
from pytest import main
34+
main([__file__, "--mobile", "--edge", "-s"])

mkdocs_build/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cssselect2==0.7.0
2929
tinycss2==1.2.1
3030
defusedxml==0.7.1
3131
mkdocs==1.4.2
32-
mkdocs-material==9.0.5
32+
mkdocs-material==9.0.6
3333
mkdocs-exclude-search==0.6.4
3434
mkdocs-simple-hooks==0.1.5
3535
mkdocs-material-extensions==1.1.1

requirements.txt

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
pip>=21.3.1;python_version>="3.6" and python_version<"3.7"
1+
pip>=21.3.1;python_version<"3.7"
22
pip>=22.3.1;python_version>="3.7"
3-
packaging>=21.3;python_version>="3.6" and python_version<"3.7"
3+
packaging>=21.3;python_version<"3.7"
44
packaging>=23.0;python_version>="3.7"
5-
setuptools>=59.6.0;python_version>="3.6" and python_version<"3.7"
5+
setuptools>=59.6.0;python_version<"3.7"
66
setuptools>=65.7.0;python_version>="3.7"
7-
tomli>=1.2.3;python_version>="3.6" and python_version<"3.7"
7+
tomli>=1.2.3;python_version<"3.7"
88
tomli>=2.0.1;python_version>="3.7"
99
tqdm>=4.64.1
1010
wheel>=0.37.1;python_version<"3.7"
1111
wheel>=0.38.4;python_version>="3.7"
12-
attrs==22.1.0;python_version>="3.6" and python_version<"3.7"
12+
attrs==22.1.0;python_version<"3.7"
1313
attrs>=22.2.0;python_version>="3.7"
14-
PyYAML>=6.0;python_version>="3.6"
15-
certifi>=2022.12.7;python_version>="3.6"
16-
filelock>=3.4.1;python_version>="3.6" and python_version<"3.7"
14+
PyYAML>=6.0
15+
certifi>=2022.12.7
16+
filelock>=3.4.1;python_version<"3.7"
1717
filelock>=3.9.0;python_version>="3.7"
18-
platformdirs>=2.4.0;python_version>="3.6" and python_version<"3.7"
18+
platformdirs>=2.4.0;python_version<"3.7"
1919
platformdirs>=2.6.2;python_version>="3.7"
20-
pyparsing>=3.0.7;python_version>="3.6" and python_version<"3.7"
20+
pyparsing>=3.0.7;python_version<"3.7"
2121
pyparsing>=3.0.9;python_version>="3.7"
2222
six==1.16.0
23-
idna==3.4;python_version>="3.6"
24-
chardet==4.0.0;python_version>="3.6" and python_version<"3.7"
23+
idna==3.4
24+
chardet==4.0.0;python_version<"3.7"
2525
chardet==5.1.0;python_version>="3.7"
2626
charset-normalizer==2.0.12;python_version<"3.7"
2727
charset-normalizer==3.0.1;python_version>="3.7"
@@ -42,22 +42,22 @@ wsproto==1.2.0;python_version>="3.7"
4242
selenium==3.141.0;python_version<"3.7"
4343
selenium==4.7.2;python_version>="3.7"
4444
msedge-selenium-tools==3.141.3;python_version<"3.7"
45-
more-itertools==8.14.0;python_version>="3.6" and python_version<"3.7"
45+
more-itertools==8.14.0;python_version<"3.7"
4646
more-itertools==9.0.0;python_version>="3.7"
4747
cssselect==1.1.0;python_version<"3.7"
4848
cssselect==1.2.0;python_version>="3.7"
4949
sortedcontainers==2.4.0
50-
fasteners==0.17.3;python_version>="3.6" and python_version<"3.7"
50+
fasteners==0.17.3;python_version<"3.7"
5151
fasteners==0.18;python_version>="3.7"
5252
execnet==1.9.0
5353
iniconfig==1.1.1;python_version<"3.7"
5454
iniconfig==2.0.0;python_version>="3.7"
55-
pluggy==1.0.0;python_version>="3.6"
56-
py==1.11.0;python_version>="3.6"
55+
pluggy==1.0.0
56+
py==1.11.0
5757
pytest==7.0.1;python_version<"3.7"
5858
pytest==7.2.1;python_version>="3.7"
59-
pytest-forked==1.4.0;python_version>="3.6"
60-
pytest-html==2.0.1;python_version>="3.6"
59+
pytest-forked==1.4.0
60+
pytest-html==2.0.1
6161
pytest-metadata==1.11.0;python_version<"3.7"
6262
pytest-metadata==2.0.4;python_version>="3.7"
6363
pytest-ordering==0.6
@@ -70,37 +70,40 @@ sbvirtualdisplay==1.1.1
7070
behave==1.2.6
7171
parse==1.19.0
7272
parse-type==0.6.0
73-
soupsieve==2.3.2.post1;python_version>="3.6"
74-
beautifulsoup4==4.11.1;python_version>="3.6"
75-
cryptography==36.0.2;python_version>="3.6" and python_version<"3.7"
73+
soupsieve==2.3.2.post1
74+
beautifulsoup4==4.11.1
75+
cryptography==36.0.2;python_version<"3.7"
7676
cryptography==39.0.0;python_version>="3.7"
77-
pygments==2.14.0;python_version>="3.6"
78-
pyreadline3==3.4.1;platform_system=="Windows" and python_version>="3.6"
77+
pygments==2.14.0
78+
pyreadline3==3.4.1;platform_system=="Windows"
7979
tabcompleter==1.1.0
80-
pdbp==1.2.7
81-
colorama==0.4.5;python_version>="3.6" and python_version<"3.7"
80+
pdbp==1.2.8
81+
colorama==0.4.5;python_version<"3.7"
8282
colorama==0.4.6;python_version>="3.7"
8383
exceptiongroup==1.1.0;python_version>="3.7"
84-
importlib-metadata==4.2.0;python_version>="3.6" and python_version<"3.8"
84+
importlib-metadata==4.2.0;python_version<"3.8"
8585
pycparser==2.21
86-
pyotp==2.7.0;python_version>="3.6" and python_version<"3.7"
86+
pyotp==2.7.0;python_version<"3.7"
8787
pyotp==2.8.0;python_version>="3.7"
8888
cffi==1.15.1
89-
typing-extensions==4.1.1;python_version>="3.6" and python_version<"3.7"
89+
typing-extensions==4.1.1;python_version<"3.7"
9090
typing-extensions==4.4.0;python_version>="3.7" and python_version<"3.9"
91-
rich==12.6.0;python_version>="3.6" and python_version<"3.7"
92-
rich==13.1.0;python_version>="3.7" and python_version<"4.0"
91+
commonmark==0.9.1;python_version<"3.7"
92+
markdown-it-py==2.1.0;python_version>="3.7"
93+
mdurl==0.1.2;python_version>="3.7"
94+
rich==12.6.0;python_version<"3.7"
95+
rich==13.2.0;python_version>="3.7"
9396

9497
# --- Testing Requirements --- #
9598
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)
9699

97-
coverage==6.2;python_version>="3.6" and python_version<"3.7"
100+
coverage==6.2;python_version<"3.7"
98101
coverage==7.0.5;python_version>="3.7"
99-
pytest-cov==4.0.0;python_version>="3.6"
100-
flake8==5.0.4;python_version>="3.6" and python_version<"3.9"
102+
pytest-cov==4.0.0
103+
flake8==5.0.4;python_version<"3.9"
101104
flake8==6.0.0;python_version>="3.9"
102-
mccabe==0.7.0;python_version>="3.6"
103-
pyflakes==2.5.0;python_version>="3.6" and python_version<"3.9"
105+
mccabe==0.7.0
106+
pyflakes==2.5.0;python_version<"3.9"
104107
pyflakes==3.0.1;python_version>="3.9"
105-
pycodestyle==2.9.1;python_version>="3.6" and python_version<"3.9"
108+
pycodestyle==2.9.1;python_version<"3.9"
106109
pycodestyle==2.10.0;python_version>="3.9"

0 commit comments

Comments
 (0)