diff --git a/README.md b/README.md index 95a112f7473..241e0190770 100755 --- a/README.md +++ b/README.md @@ -54,13 +54,15 @@

+

SeleniumBase is the professional toolkit for web automation activities. Built for testing websites, bypassing CAPTCHAs, enhancing productivity, completing tasks, and scaling your business.

+ -------- 📚 Learn from [**over 200 examples** in the **SeleniumBase/examples/** folder](https://github.com/seleniumbase/SeleniumBase/tree/master/examples). 👤 Note that SeleniumBase UC Mode (Stealth Mode) has its own ReadMe. -ℹī¸ Scripts can be called via python, although some Syntax Formats expect pytest (a Python unit-testing framework included with SeleniumBase that can discover & collect tests automatically). +ℹī¸ Scripts can be called via python, although some Syntax Formats expect pytest (a Python unit-testing framework included with SeleniumBase that can discover, collect, and run tests automatically).

📗 Here's my_first_test.py, which tests login, shopping, and checkout:

diff --git a/examples/presenter/uc_presentation.py b/examples/presenter/uc_presentation.py index ba6247cdc0c..ae5ff4dc2f2 100644 --- a/examples/presenter/uc_presentation.py +++ b/examples/presenter/uc_presentation.py @@ -30,12 +30,12 @@ def test_presentation(self): self.get_new_driver(undetectable=True) url = "https://gitlab.com/users/sign_in" try: - self.driver.uc_open_with_reconnect(url, reconnect_time=3) + self.uc_open_with_reconnect(url, reconnect_time=3) try: self.assert_text("Username", '[for="user_login"]', timeout=3) self.post_message("SeleniumBase wasn't detected", duration=4) except Exception: - self.driver.uc_open_with_reconnect(url, reconnect_time=4) + self.uc_open_with_reconnect(url, reconnect_time=4) self.assert_text("Username", '[for="user_login"]', timeout=3) self.post_message("SeleniumBase wasn't detected", duration=4) finally: @@ -249,8 +249,7 @@ def test_presentation(self): code=( "from seleniumbase import SB\n\n" "with SB(uc=True) as sb:\n" - ' sb.driver.get(' - '"https://seleniumbase.io/simple/login")\n' + ' sb.get("seleniumbase.io/simple/login")\n' ' sb.type("#username", "demo_user")\n' ' sb.type("#password", "secret_pass")\n' ' sb.click(\'a:contains("Sign in")\')\n' @@ -266,7 +265,7 @@ def test_presentation(self): try: with SB(uc=True) as sb: - sb.driver.get("https://seleniumbase.io/simple/login") + sb.get("https://seleniumbase.io/simple/login") sb.type("#username", "demo_user") sb.type("#password", "secret_pass") sb.click('a:contains("Sign in")') @@ -285,7 +284,7 @@ def test_presentation(self): code=( "from seleniumbase import SB\n\n" "with SB(uc=True, demo=True) as sb:\n" - ' sb.driver.get(' + ' sb.get(' '"https://seleniumbase.io/simple/login")\n' ' sb.type("#username", "demo_user")\n' ' sb.type("#password", "secret_pass")\n' @@ -301,7 +300,7 @@ def test_presentation(self): try: with SB(uc=True, demo=True) as sb: - sb.driver.get("https://seleniumbase.io/simple/login") + sb.get("https://seleniumbase.io/simple/login") sb.type("#username", "demo_user") sb.type("#password", "secret_pass") sb.click('a:contains("Sign in")') @@ -340,11 +339,11 @@ def test_presentation(self): code=( "from seleniumbase import SB\n\n" "with SB(uc=True) as sb:\n" - ' sb.driver.get("https://nowsecure.nl/#relax")\n' + ' sb.get("https://nowsecure.nl/#relax")\n' " sb.sleep(1)\n" ' if not sb.is_text_visible("OH YEAH, you passed", "h1"):\n' " sb.get_new_driver(undetectable=True)\n" - ' sb.driver.get("https://nowsecure.nl/#relax")\n' + ' sb.get("https://nowsecure.nl/#relax")\n' " sb.sleep(1)\n" ' sb.activate_demo_mode()\n' ' sb.assert_text("OH YEAH, you passed!", "h1", timeout=3)\n' @@ -354,10 +353,10 @@ def test_presentation(self): try: with SB(uc=True) as sb: - sb.driver.uc_open_with_tab("https://nowsecure.nl/#relax") + sb.uc_open_with_tab("https://nowsecure.nl/#relax") sb.sleep(1) if not sb.is_text_visible("OH YEAH, you passed", "h1"): - sb.driver.uc_open_with_tab("https://nowsecure.nl/#relax") + sb.uc_open_with_tab("https://nowsecure.nl/#relax") sb.sleep(1) sb.activate_demo_mode() sb.assert_text("OH YEAH, you passed!", "h1", timeout=3) diff --git a/examples/presenter/uc_presentation_3.py b/examples/presenter/uc_presentation_3.py index bc428759344..a3da212dcd4 100644 --- a/examples/presenter/uc_presentation_3.py +++ b/examples/presenter/uc_presentation_3.py @@ -18,7 +18,7 @@ def test_presentation_3(self): self.begin_presentation(filename="uc_presentation.html") self.open("https://seleniumbase.io/other/uc3_title.jpg") - self.sleep(3) + self.sleep(2.5) self.create_presentation(theme="serif", transition="fade") self.add_slide( @@ -108,11 +108,11 @@ def test_presentation_3(self): "

Special UC Mode methods for clicking CAPTCHAs:" "


" "\n\n\n\n" @@ -171,7 +171,7 @@ def test_presentation_3(self): "with SB(uc=True) as sb:\n" ' url = "https://gitlab.com/users/sign_in"\n' " sb.uc_open_with_reconnect(url, 4)\n" - " uc_gui_handle_captcha()\n\n" + " sb.uc_gui_handle_captcha()\n\n" " ...\n\n\n\n\n\n" ), ) @@ -183,7 +183,7 @@ def test_presentation_3(self): "with SB(uc=True) as sb:\n" ' url = "https://gitlab.com/users/sign_in"\n' " sb.uc_open_with_reconnect(url, 4)\n" - " uc_gui_handle_captcha()\n\n" + " sb.uc_gui_handle_captcha()\n\n" ' sb.assert_text("Username", \'[for="user_login"]\',' ' timeout=3)\n' ' sb.assert_element(\'[for="user_login"]\')\n' @@ -221,7 +221,7 @@ def test_presentation_3(self): "with SB(uc=True) as sb:\n" ' url = "https://gitlab.com/users/sign_in"\n' " sb.uc_open_with_reconnect(url, 4)\n" - " uc_gui_click_captcha()\n\n" + " sb.uc_gui_click_captcha()\n\n" " ...\n\n\n\n\n" ), ) @@ -233,7 +233,7 @@ def test_presentation_3(self): "with SB(uc=True) as sb:\n" ' url = "https://gitlab.com/users/sign_in"\n' " sb.uc_open_with_reconnect(url, 4)\n" - " uc_gui_click_captcha()\n\n" + " sb.uc_gui_click_captcha()\n\n" ' sb.assert_text("Username", \'[for="user_login"]\',' ' timeout=3)\n' ' sb.assert_element(\'[for="user_login"]\')\n' @@ -252,8 +252,8 @@ def test_presentation_3(self): "
  • Navigate with stealth by calling " "sb.uc_open_with_reconnect(url)" "

  • \n" - "
  • Use uc_gui_handle_captcha()" - " or uc_gui_click_captcha()" + "
  • Use sb.uc_gui_handle_captcha()" + " or sb.uc_gui_click_captcha()" " to bypass CAPTCHAs as needed.
  • \n" "\n" "


    (It's that easy!)


    \n" @@ -263,7 +263,7 @@ def test_presentation_3(self): "

    " "