Skip to content

Commit 64ebebe

Browse files
authored
Merge pull request #1556 from seleniumbase/update-default-uc-settings
Update default settings for Undetected Mode
2 parents 1d09bf3 + 773a2d5 commit 64ebebe

File tree

14 files changed

+119
-59
lines changed

14 files changed

+119
-59
lines changed

README.md

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<meta property="og:site_name" content="SeleniumBase">
22
<meta property="og:title" content="SeleniumBase: Python Web Automation and E2E Testing" />
33
<meta property="og:description" content="Fast, easy, and reliable Web/UI testing with Python." />
4-
<meta property="og:keywords" content="Python, pytest, selenium, webdriver, testing, automation, seleniumbase, framework, RPA, behave, BDD, nosetests, dashboard, recorder, reports, gui, screenshots">
4+
<meta property="og:keywords" content="Python, pytest, selenium, webdriver, testing, automation, seleniumbase, framework, dashboard, recorder, reports, screenshots">
55
<meta property="og:image" content="https://seleniumbase.github.io/cdn/img/mac_sb_logo_5b.png" />
66
<link rel="icon" href="https://seleniumbase.github.io/img/logo3b.png" />
77

8-
<h1>SeleniumBase</h1>
8+
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/sb_logo_p3.png" alt="SeleniumBase" title="SeleniumBase" width="406" /></a></p>
99

10-
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/logo_base_3.png" alt="SeleniumBase" title="SeleniumBase" width="234" /></a></p>
10+
<h3 align="center"><b>All-in-one Test Automation Framework</b></h3>
1111

12-
<h3 align="center"><b>All-in-one test automation framework</b></h3>
12+
<h4 align="center"><img src="https://seleniumbase.github.io/cdn/img/python_logo.png" title="SeleniumBase" width="29" /> <b>For Python enthusiasts and enterprise developers</b> <img src="https://seleniumbase.github.io/cdn/img/python_logo.png" title="SeleniumBase" width="29" /></h4>
1313

1414
<p align="center"><a href="https://pypi.python.org/pypi/seleniumbase" target="_blank"><img src="https://img.shields.io/pypi/v/seleniumbase.svg?color=3399EE" alt="PyPI version" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/releases" target="_blank"><img src="https://img.shields.io/github/v/release/seleniumbase/SeleniumBase.svg?color=22AAEE" alt="GitHub version" /></a> <a href="https://seleniumbase.io"><img src="https://img.shields.io/badge/docs-seleniumbase.io-11BBAA.svg" alt="SeleniumBase Docs" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/actions" target="_blank"><img src="https://github.com/seleniumbase/SeleniumBase/workflows/CI%20build/badge.svg" alt="SeleniumBase GitHub Actions" /></a> <a href="https://gitter.im/seleniumbase/SeleniumBase" target="_blank"><img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="SeleniumBase" /></a></p>
1515

@@ -960,21 +960,23 @@ self.assert_text("Tea. Earl Grey. Hot.", "div#trek div.picard div.quotes", timeo
960960
🔵 Asserting Anything:
961961
962962
```python
963-
self.assert_true(myvar1 == something)
963+
self.assert_true(var1 == var2)
964+
965+
self.assert_false(var1 == var2)
964966
965967
self.assert_equal(var1, var2)
966968
```
967969
968970
🔵 Useful Conditional Statements: (with creative examples)
969971
970-
* ``is_element_visible(selector)`` (visible on the page)
972+
``is_element_visible(selector):`` (visible on the page)
971973
972974
```python
973975
if self.is_element_visible('div#warning'):
974976
print("Red Alert: Something bad might be happening!")
975977
```
976978
977-
* ``is_element_present(selector)`` (present in the HTML)
979+
``is_element_present(selector):`` (present in the HTML)
978980
979981
```python
980982
if self.is_element_present('div#top_secret img.tracking_cookie'):
@@ -984,16 +986,23 @@ else:
984986
self.contact_the_nsa(url=current_url, message="Dark Zone Found") # Not a real SeleniumBase method
985987
```
986988
987-
Another example:
988-
989989
```python
990990
def is_there_a_cloaked_klingon_ship_on_this_page():
991991
if self.is_element_present("div.ships div.klingon"):
992992
return not self.is_element_visible("div.ships div.klingon")
993993
return False
994994
```
995995
996-
* ``is_text_visible(text, selector)`` (text visible on element)
996+
``is_text_visible(text, selector):`` (text visible on element)
997+
998+
```python
999+
if self.is_text_visible("You Shall Not Pass!", "h1"):
1000+
self.open("https://www.youtube.com/watch?v=3xYXUeSmb-Y")
1001+
```
1002+
1003+
<div></div>
1004+
<details>
1005+
<summary> ▶️ Click for a longer example of <code>is_text_visible():</code></summary>
9971006
9981007
```python
9991008
def get_mirror_universe_captain_picard_superbowl_ad(superbowl_year):
@@ -1022,6 +1031,15 @@ def get_mirror_universe_captain_picard_superbowl_ad(superbowl_year):
10221031
raise Exception("Reports of my assimilation are greatly exaggerated.")
10231032
```
10241033
1034+
</details>
1035+
1036+
``is_link_text_visible(link_text):``
1037+
1038+
```python
1039+
if self.is_link_text_visible("Stop! Hammer time!"):
1040+
self.click_link("Stop! Hammer time!")
1041+
```
1042+
10251043
🔵 Switching Tabs:
10261044
10271045
<p>If your test opens up a new tab/window, you can switch to it. (SeleniumBase automatically switches to new tabs that don't open to <code>about:blank</code> URLs.)</p>
@@ -1164,15 +1182,15 @@ pytest --reruns=1 --reruns-delay=1
11641182
</p>
11651183
<p><div><a href="https://github.com/mdmintz">https://github.com/mdmintz</a></div></p>
11661184
1167-
<div><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/fancy_logo_14.png" title="SeleniumBase" width="200" /></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>
1185+
<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>
11681186
11691187
<p><div>
1170-
<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="40" /></a></span>
1188+
<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="43" /></a></span>
11711189
<span><a href="https://www.facebook.com/SeleniumBase" target="_blank"><img src="https://seleniumbase.github.io/img/social/share_facebook.svg" title="SeleniumBase on Facebook" alt="SeleniumBase on Facebook" width="37" /></a></span>
1172-
<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="32" /></a></span>
1190+
<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="35" /></a></span>
11731191
<span><a href="https://instagram.com/seleniumbase" target="_blank"><img src="https://seleniumbase.github.io/img/social/share_instagram.svg" title="SeleniumBase on Instagram" alt="SeleniumBase on Instagram" width="33" /></a></span>
1174-
<span><a href="https://twitter.com/seleniumbase" target="_blank"><img src="https://seleniumbase.github.io/img/social/share_twitter.svg" title="SeleniumBase on Twitter" alt="SeleniumBase on Twitter" width="40" /></a></span>
1192+
<span><a href="https://twitter.com/seleniumbase" target="_blank"><img src="https://seleniumbase.github.io/img/social/share_twitter.svg" title="SeleniumBase on Twitter" alt="SeleniumBase on Twitter" width="39" /></a></span>
11751193
</div></p>
11761194
1177-
<p><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/super_logo_sb.png" alt="SeleniumBase" title="SeleniumBase" width="200" /></a></p>
1195+
<p><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/sb_logo_i2.png" alt="SeleniumBase" title="SeleniumBase" width="240" /></a></p>
11781196
<p><a href="https://www.python.org/downloads/" target="_blank"><img src="https://img.shields.io/pypi/pyversions/seleniumbase.svg?color=22AAEE&logo=python" title="Supported Python Versions" /></a></p>

examples/migration/raw_selenium/flaky_messy_raw.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Flaky Raw Selenium Example - (This test does NOT use SeleniumBase)"""
2+
import pytest
23
import sys
34
from selenium import webdriver
45
from selenium.webdriver.common.by import By
@@ -63,3 +64,8 @@ def test_add_item_to_cart(self):
6364
self.driver.find_element(by_css, "#react-burger-menu-btn").click()
6465
self.driver.find_element(by_css, "a#logout_sidebar_link").click()
6566
self.driver.find_element(by_css, "input#login-button")
67+
68+
69+
# When run with "python" instead of "pytest"
70+
if __name__ == "__main__":
71+
pytest.main([__file__])

examples/migration/raw_selenium/long_messy_raw.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Long & Messy Raw Selenium Example - (This test does NOT use SeleniumBase)"""
2+
import pytest
23
import sys
34
from selenium import webdriver
45
from selenium.webdriver.common.by import By
@@ -87,3 +88,8 @@ def test_add_item_to_cart(self):
8788
WebDriverWait(self.driver, 10).until(
8889
EC.visibility_of_element_located((by_css, "input#login-button"))
8990
)
91+
92+
93+
# When run with "python" instead of "pytest"
94+
if __name__ == "__main__":
95+
pytest.main([__file__])

examples/migration/raw_selenium/messy_raw.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Messy Raw Selenium Example - (This test does NOT use SeleniumBase)"""
2+
import pytest
23
import sys
34
from selenium import webdriver
45
from selenium.webdriver.support import expected_conditions as EC
@@ -75,3 +76,8 @@ def test_add_item_to_cart(self):
7576
self.wait_for_element_clickable("#react-burger-menu-btn").click()
7677
self.wait_for_element_clickable("a#logout_sidebar_link").click()
7778
self.wait_for_element_visible("input#login-button")
79+
80+
81+
# When run with "python" instead of "pytest"
82+
if __name__ == "__main__":
83+
pytest.main([__file__])

examples/migration/raw_selenium/refined_raw.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Refined Raw Selenium Example - (This test does NOT use SeleniumBase)"""
2+
import pytest
23
import sys
34
from selenium import webdriver
45
from selenium.webdriver.support import expected_conditions as EC
@@ -117,3 +118,8 @@ def test_add_item_to_cart(self):
117118
self.click("#react-burger-menu-btn")
118119
self.click("a#logout_sidebar_link")
119120
self.assert_element("input#login-button")
121+
122+
123+
# When run with "python" instead of "pytest"
124+
if __name__ == "__main__":
125+
pytest.main([__file__])

examples/migration/raw_selenium/simple_sbase.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Clean SeleniumBase Example - (Uses simple, reliable methods)"""
2+
import pytest
23
from seleniumbase import BaseCase
34

45

@@ -18,3 +19,8 @@ def test_add_item_to_cart(self):
1819
self.click("#react-burger-menu-btn")
1920
self.click("a#logout_sidebar_link")
2021
self.assert_element("input#login-button")
22+
23+
24+
# When run with "python" instead of "pytest"
25+
if __name__ == "__main__":
26+
pytest.main([__file__])

examples/raw_browser_launcher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
page_actions.wait_for_element(driver, "4", "id").click()
1111
page_actions.wait_for_element(driver, "2", "id").click()
1212
page_actions.wait_for_text(driver, "42", "output", "id")
13-
js_utils.highlight_with_js(driver, "#output", 6, "")
13+
js_utils.highlight_with_js(driver, "#output", loops=6)
1414
finally:
1515
driver.quit()
1616

1717
# Example 2 using default args or command-line options
1818
driver = Driver()
1919
driver.get("https://seleniumbase.github.io/demo_page")
20-
js_utils.highlight_with_js(driver, "h2", 5, "")
20+
js_utils.highlight_with_js(driver, "h2", loops=5)
2121
by_css = "css selector"
2222
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
2323
driver.find_element(by_css, "#checkBox1").click()
24-
js_utils.highlight_with_js(driver, "img", 5, "")
24+
js_utils.highlight_with_js(driver, "img", loops=5)
2525
driver.quit() # If the script fails early, the driver still quits

examples/raw_driver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
# Python Context Manager
77
with Driver() as driver: # By default, browser="chrome"
88
driver.get("https://google.com/ncr")
9-
js_utils.highlight_with_js(driver, 'img[alt="Google"]', 6, "")
9+
js_utils.highlight_with_js(driver, 'img[alt="Google"]', loops=6)
1010

1111
with Driver() as driver: # Also accepts command-line options
1212
driver.get("https://seleniumbase.github.io/demo_page")
13-
js_utils.highlight_with_js(driver, "h2", 5, "")
13+
js_utils.highlight_with_js(driver, "h2", loops=5)
1414
by_css = "css selector"
1515
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
1616
driver.find_element(by_css, "#checkBox1").click()
17-
js_utils.highlight_with_js(driver, "img", 5, "")
17+
js_utils.highlight_with_js(driver, "img", loops=5)
1818

1919
# Python Context Manager (with options given)
2020
with Driver(browser="chrome", incognito=True) as driver:
2121
driver.get("https://seleniumbase.io/apps/calculator")
2222
page_actions.wait_for_element(driver, "4", "id").click()
2323
page_actions.wait_for_element(driver, "2", "id").click()
2424
page_actions.wait_for_text(driver, "42", "output", "id")
25-
js_utils.highlight_with_js(driver, "#output", 6, "")
25+
js_utils.highlight_with_js(driver, "#output", loops=6)

0 commit comments

Comments
 (0)