Skip to content

Refresh JS and Python dependencies #2484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 46 additions & 68 deletions README.md

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions examples/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,34 @@

--------

Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py): (Default option: ``--chrome``)
Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py): (Default option: ``--chrome``)

```bash
pytest test_demo_site.py
pytest my_first_test.py
```

<img src="https://seleniumbase.github.io/cdn/gif/demo_page_4.gif" title="SeleniumBase Demo Page" /><br />
<img src="https://seleniumbase.github.io/cdn/gif/fast_swag.gif" title="SeleniumBase Demo Page" /><br />

--------

Run an example test in Firefox:
Here's one way of changing the browser to Firefox:

```bash
pytest my_first_test.py --browser=firefox
pytest my_first_test.py --firefox
```

--------

Another [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py) for a web page that has lots of different HTML items:

```bash
pytest test_demo_site.py
```

<img src="https://seleniumbase.github.io/cdn/gif/demo_page_4.gif" title="SeleniumBase Demo Page" /><br />

--------

Run an example test in ``--demo`` mode: (highlight assertions)

```bash
Expand Down
2 changes: 1 addition & 1 deletion examples/example_logs/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ python -m http.server 1948
🔵 Here's a full example of what the SeleniumBase Dashboard may look like:

```bash
pytest test_suite.py --dashboard --rs --headless
pytest test_suite.py test_image_saving.py --dashboard --rs --headless
```

<img src="https://seleniumbase.github.io/cdn/img/dashboard_2.png" alt="The SeleniumBase Dashboard" title="The SeleniumBase Dashboard" width="480" />
Expand Down
1 change: 1 addition & 0 deletions examples/hack_the_planet.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_all_your_base_are_belong_to_us(self):
self.set_text_content('#shelf-1 a[href*="mac"]', "ALL")
self.set_text_content('#shelf-1 a[href*="iphone"]', "YOUR")
self.set_text_content('#shelf-1 a[href*="ipad"]', "BASE")
self.remove_element('#shelf-1 [role="listitem"]:nth-child(5)')
self.set_text_content('#shelf-1 a[href*="watch"]', "ARE")
self.set_text_content('#shelf-1 a[href*="airpods"]', "BELONG")
self.set_text_content('#shelf-1 a[href*="airtag"]', "TO")
Expand Down
45 changes: 18 additions & 27 deletions examples/verify_undetected.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,24 @@


class UndetectedTest(BaseCase):
def verify_success(self):
self.assert_text("OH YEAH, you passed!", "h1", timeout=6.25)
self.post_message("Selenium wasn't detected!", duration=2.8)
self._print("\n Success! Website did not detect Selenium! ")

def fail_me(self):
self.fail('Selenium was detected! Try using: "pytest --uc"')

def test_browser_is_undetected(self):
if not (self.undetectable):
if not self.undetectable:
self.get_new_driver(undetectable=True)
self.driver.get("https://nowsecure.nl/#relax")
try:
self.verify_success()
except Exception:
self.clear_all_cookies()
self.driver.uc_open_with_reconnect(
"https://nowsecure.nl/#relax", reconnect_time=3
)
self.sleep(1.2)
if not self.is_text_visible("OH YEAH, you passed!", "h1"):
self.get_new_driver(undetectable=True)
self.driver.get("https://nowsecure.nl/#relax")
try:
self.verify_success()
except Exception:
if self.is_element_visible('iframe[src*="challenge"]'):
with self.frame_switch('iframe[src*="challenge"]'):
self.click("span.mark")
else:
self.fail_me()
try:
self.verify_success()
except Exception:
self.fail_me()
self.driver.uc_open_with_reconnect(
"https://nowsecure.nl/#relax", reconnect_time=3
)
self.sleep(1.2)
if not self.is_text_visible("OH YEAH, you passed!", "h1"):
if self.is_element_visible('iframe[src*="challenge"]'):
with self.frame_switch('iframe[src*="challenge"]'):
self.click("span.mark")
self.sleep(2)
self.assert_text("OH YEAH, you passed!", "h1", timeout=3)
self.post_message("Selenium wasn't detected!", duration=2.8)
self._print("\n Success! Website did not detect Selenium! ")
15 changes: 14 additions & 1 deletion help_docs/demo_mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@

## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Demo Mode 🎦

<p align="left"><img src="https://seleniumbase.github.io/cdn/gif/xkcd_vid.gif" width="400" alt="SeleniumBase Example" title="SeleniumBase Example" /></p>
<p align="left"><img src="https://seleniumbase.github.io/cdn/gif/xkcd_vid.gif" width="480" alt="SeleniumBase Example" title="SeleniumBase Example" /></p>

<p align="left">🔵 <b translate="no">Demo Mode</b> helps you see what a test is doing.</p>

<p align="left">🏇💨 👀 If a test runs too fast for your eyes, use <b translate="no">Demo Mode</b> to slow it down, highlight actions, and display assertions. Example usage:</p>

```bash
cd examples/
pytest test_coffee_cart.py --demo
```

<p align="left"><a href="https://seleniumbase.io/coffee/" target="_blank"><img src="https://seleniumbase.github.io/cdn/gif/coffee_cart.gif" width="480" alt="SeleniumBase Coffee Cart Test" title="SeleniumBase Coffee Cart Test" /></a></p>

> <p>(<code translate="no">--demo</code> mode slows down tests and highlights actions)</p>

--------

Another example:

```bash
pytest my_first_test.py --demo
```
Expand Down
14 changes: 7 additions & 7 deletions help_docs/features_list.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- SeleniumBase Docs -->

<!-- YouTube View --><a href="https://www.youtube.com/watch?v=EablmOazy-k"><img src="http://img.youtube.com/vi/EablmOazy-k/0.jpg" title="SeleniumBase on YouTube" width="285" /></a>
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=EablmOazy-k">Watch the new tutorial on YouTube</a></b>)</p>
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=EablmOazy-k"><img src="http://img.youtube.com/vi/EablmOazy-k/0.jpg" title="SeleniumBase on YouTube" width="365" /></a>
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=EablmOazy-k">Watch the SeleniumBase tutorial from Selenium-Conf-2023 on YouTube</a></b>)</p>

<a id="feature_list"></a>

Expand All @@ -25,7 +25,7 @@
* Can run tests with proxy+auth via PAC URL. (``--proxy-pac-url=USER:[email protected]``)
* Can run tests with a customized browser user agent. (``--agent=USER_AGENT_STRING``)
* Can set a Chromium User Data Directory/Profile to load. (``--user-data-dir=DIR``)
* Can avoid detection by sites that try to block Selenium. (``--undetected``/``--uc``)
* Can [avoid detection](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/uc_mode.md) by sites that try to block Selenium. (``--undetected``/``--uc``)
* Can integrate with [selenium-wire](https://github.com/wkeeling/selenium-wire) for inspecting browser requests. (``--wire``)
* Can load Chrome Extension ZIP files. (``--extension-zip=ZIP``)
* Can load Chrome Extension folders. (``--extension-dir=DIR``)
Expand All @@ -50,11 +50,11 @@

--------

<!-- YouTube View --><a href="https://www.youtube.com/watch?v=yEQeAU_mrg0"><img src="http://img.youtube.com/vi/yEQeAU_mrg0/0.jpg" title="SeleniumBase on YouTube" width="285" /></a>
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=yEQeAU_mrg0"><img src="http://img.youtube.com/vi/yEQeAU_mrg0/0.jpg" title="SeleniumBase on YouTube" width="365" /></a>
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=yEQeAU_mrg0">Have fun with test automation!</a></b>)</p>

(<b><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw">Watch the old tutorial on YouTube</a></b>)
(<b><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw">Watch the original tutorial on YouTube</a></b>)

<p align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/sb_logo_10.png" alt="SeleniumBase" title="SeleniumBase" width="200"></a></p>
<p align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/sb_logo_10.png" alt="SeleniumBase" title="SeleniumBase" width="240"></a></p>

[<img src="https://seleniumbase.github.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="200">](https://seleniumbase.io/)
[<img src="https://seleniumbase.github.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="240">](https://seleniumbase.io/)
8 changes: 4 additions & 4 deletions help_docs/webdriver_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ brew upgrade geckodriver

**Linux shortcuts**:

If you still need the web drivers, here are some scripts to help you get ``chromedriver`` and ``geckodriver`` on a Linux machine:
If you still need drivers, these scripts download ``chromedriver`` and ``geckodriver`` to a Linux machine:

```bash
wget https://chromedriver.storage.googleapis.com/72.0.3626.69/chromedriver_linux64.zip
wget https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
mv chromedriver /usr/local/bin/
chmod +x /usr/local/bin/chromedriver
```

```bash
wget https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz
tar xvfz geckodriver-v0.33.0-linux64.tar.gz
wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz
tar xvfz geckodriver-v0.34.0-linux64.tar.gz
mv geckodriver /usr/local/bin/
chmod +x /usr/local/bin/geckodriver
```
Expand Down
6 changes: 3 additions & 3 deletions mkdocs_build/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ pipdeptree>=2.13.2
python-dateutil>=2.8.2
Markdown==3.5.2
markdown2==2.4.12
MarkupSafe==2.1.4
MarkupSafe==2.1.5
Jinja2==3.1.3
click==8.1.7
ghp-import==2.1.0
watchdog==3.0.0
watchdog==4.0.0
cairocffi==1.6.1
pathspec==0.12.1
Babel==2.14.0
Expand All @@ -20,7 +20,7 @@ lxml==5.1.0
pyquery==2.0.0
readtime==3.0.0
mkdocs==1.5.3
mkdocs-material==9.5.6
mkdocs-material==9.5.9
mkdocs-exclude-search==0.6.6
mkdocs-simple-hooks==0.1.5
mkdocs-material-extensions==1.3.1
13 changes: 7 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pip>=23.3.2
pip>=24.0
packaging>=23.2
setuptools>=68.0.0;python_version<"3.8"
setuptools>=69.0.3;python_version>="3.8"
setuptools>=69.1.0;python_version>="3.8"
wheel>=0.42.0
attrs>=23.2.0
certifi>=2023.11.17
certifi>=2024.2.2
filelock>=3.12.2;python_version<"3.8"
filelock>=3.13.1;python_version>="3.8"
platformdirs>=4.0.0;python_version<"3.8"
platformdirs>=4.1.0;python_version>="3.8"
platformdirs>=4.2.0;python_version>="3.8"
typing-extensions>=4.9.0;python_version>="3.8"
parse>=1.20.1
parse-type>=0.6.2
Expand All @@ -18,7 +18,7 @@ idna==3.6
chardet==5.2.0
charset-normalizer==3.3.2
urllib3>=1.26.18,<2;python_version<"3.10"
urllib3>=1.26.18,<2.2.0;python_version>="3.10"
urllib3>=1.26.18,<2.3.0;python_version>="3.10"
requests==2.31.0
pynose==1.4.8
sniffio==1.3.0
Expand All @@ -41,7 +41,8 @@ py==1.11.0
pytest==7.4.4;python_version<"3.8"
pytest==8.0.0;python_version>="3.8"
pytest-html==2.0.1
pytest-metadata==3.0.0
pytest-metadata==3.0.0;python_version<"3.8"
pytest-metadata==3.1.0;python_version>="3.8"
pytest-ordering==0.6
pytest-rerunfailures==13.0
pytest-xdist==3.5.0
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.23.2"
__version__ = "4.23.3"
20 changes: 20 additions & 0 deletions seleniumbase/console_scripts/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ COMMANDS:
revert-objects [SB_FILE.py] [OPTIONS]
encrypt / obfuscate
decrypt / unobfuscate
proxy (Start a basic proxy server)
download server (Get Selenium Grid JAR file)
grid-hub [start|stop] [OPTIONS]
grid-node [start|stop] --hub=[HOST/IP]
Expand Down Expand Up @@ -653,6 +654,25 @@ Runs the password encryption/obfuscation tool.
Runs the password decryption/unobfuscation tool.
(Where you can enter an encrypted password to decrypt.)

<h3>proxy</h3>

* Usage:

```bash
sbase proxy [OPTIONS]
```

* Options:

``--hostname=HOSTNAME`` (Set ``hostname``) (Default: ``127.0.0.1``)
``--port=PORT`` (Set ``port``) (Default: ``8899``)
``--help`` / ``-h`` (Display list of all available ``proxy`` options.)

* Output:

Launch a basic proxy server on the current machine.
(Uses ``127.0.0.1:8899`` as the default address.)

<h3>download</h3>

* Usage:
Expand Down
23 changes: 22 additions & 1 deletion seleniumbase/console_scripts/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
sbase revert-objects my_first_test.py
sbase encrypt
sbase decrypt
sbase proxy
sbase proxy --hostname=127.0.0.1 --port=8899
sbase download server
sbase grid-hub start
sbase grid-node start --hub=127.0.0.1
Expand Down Expand Up @@ -79,7 +81,7 @@ def show_basic_usage():
show_package_location()
show_version_info()
print("")
time.sleep(0.72) # Enough time to see the version
time.sleep(0.62) # Enough time to see the version
sc = ""
sc += ' * USAGE: "seleniumbase [COMMAND] [PARAMETERS]"\n'
sc += ' * OR: "sbase [COMMAND] [PARAMETERS]"\n'
Expand Down Expand Up @@ -108,6 +110,7 @@ def show_basic_usage():
sc += " revert-objects [SB_FILE.py] [OPTIONS]\n"
sc += " encrypt / obfuscate\n"
sc += " decrypt / unobfuscate\n"
sc += " proxy (Start a basic proxy server)\n"
sc += " download server (Get Selenium Grid JAR file)\n"
sc += " grid-hub [start|stop] [OPTIONS]\n"
sc += " grid-node [start|stop] --hub=[HOST/IP]\n"
Expand Down Expand Up @@ -1210,6 +1213,24 @@ def main():
show_options()
elif command == "behave-options" or command == "--behave-options":
show_behave_options()
elif command == "proxy" or command == "--proxy":
import fasteners
import os
import warnings

with warnings.catch_warnings():
warnings.simplefilter("ignore", category=UserWarning)
pip_find_lock = fasteners.InterProcessLock(
constants.PipInstall.FINDLOCK
)
with pip_find_lock:
try:
from proxy import proxy # noqa: F401
except Exception:
shared_utils.pip_install(
"proxy.py", version=constants.ProxyPy.VER
)
os.system("proxy %s" % " ".join(sys.argv[2:]))
elif command == "help" or command == "--help":
if len(command_args) >= 1:
if command_args[0] == "get":
Expand Down
36 changes: 24 additions & 12 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -11771,19 +11771,31 @@ def add_data_point(self, label, value, color=None, chart_name=None):
raise Exception('Expecting a numeric value for "value"!')
if not color:
color = ""
else:
color = color.replace("'", "\\'")
label = label.replace("'", "\\'")
color = color.replace("'", "\\'")
data_point = """
{
name: '%s',
y: %s,
color: '%s'
},
""" % (
label,
value,
color,
)
if color:
data_point = """
{
name: '%s',
y: %s,
color: '%s'
},
""" % (
label,
value,
color,
)
else:
data_point = """
{
name: '%s',
y: %s,
},
""" % (
label,
value,
)
data_point = textwrap.dedent(data_point)
self._chart_data[chart_name].append(data_point)
if self._chart_first_series[chart_name]:
Expand Down
Loading