-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2866 from seleniumbase/big-uc-mode-updates-and-more
Lots of UC Mode improvements, and more
- Loading branch information
Showing
27 changed files
with
743 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""UC Mode has PyAutoGUI methods for CAPTCHA-bypass.""" | ||
from seleniumbase import SB | ||
|
||
with SB(uc=True, test=True) as sb: | ||
url = "https://seleniumbase.io/antibot/login" | ||
sb.uc_open_with_disconnect(url, 2.15) | ||
sb.uc_gui_write("\t" + "demo_user") | ||
sb.uc_gui_write("\t" + "secret_pass") | ||
sb.uc_gui_press_keys("\t" + " ") # For Single-char keys | ||
sb.sleep(1.5) | ||
sb.uc_gui_press_keys(["\t", "ENTER"]) # Multi-char keys | ||
sb.reconnect(1.8) | ||
sb.assert_text("Welcome!", "h1") | ||
sb.set_messenger_theme(location="bottom_center") | ||
sb.post_message("SeleniumBase wasn't detected!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""If Brotector catches you, Gandalf blocks you!""" | ||
from seleniumbase import SB | ||
|
||
with SB(test=True) as sb: | ||
url = "https://seleniumbase.io/hobbit/login" | ||
sb.open(url) | ||
sb.click_if_visible("button") | ||
sb.assert_text("Gandalf blocked you!", "h1") | ||
sb.click("img") | ||
sb.highlight("h1") | ||
sb.sleep(3) # Gandalf: "You Shall Not Pass!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"""UC Mode has PyAutoGUI methods for CAPTCHA-bypass.""" | ||
from seleniumbase import SB | ||
|
||
with SB(uc=True, test=True) as sb: | ||
url = "https://seleniumbase.io/apps/brotector" | ||
sb.uc_open_with_disconnect(url, 2.2) | ||
sb.uc_gui_press_key("\t") | ||
sb.uc_gui_press_key(" ") | ||
sb.reconnect(2.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""The Brotector CAPTCHA in action.""" | ||
from seleniumbase import SB | ||
|
||
with SB(test=True) as sb: | ||
sb.open("https://seleniumbase.io/antibot/login") | ||
sb.highlight("h4", loops=6) | ||
sb.type("#username", "demo_user") | ||
sb.type("#password", "secret_pass") | ||
sb.click_if_visible("button span") | ||
sb.highlight("label#pText") | ||
sb.highlight("table#detections") | ||
sb.sleep(4.4) # Add time to read the table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""UC Mode has PyAutoGUI methods for CAPTCHA-bypass.""" | ||
from seleniumbase import SB | ||
|
||
with SB(uc=True, test=True) as sb: | ||
url = "https://seleniumbase.io/hobbit/login" | ||
sb.uc_open_with_disconnect(url, 2.2) | ||
sb.uc_gui_press_keys("\t ") | ||
sb.reconnect(1.5) | ||
sb.assert_text("Welcome to Middle Earth!", "h1") | ||
sb.set_messenger_theme(location="bottom_center") | ||
sb.post_message("SeleniumBase wasn't detected!") | ||
sb.click("img") | ||
sb.sleep(5.888) # Cool animation happening now! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
""" | ||
UC Mode now has uc_gui_handle_cf(), which uses PyAutoGUI. | ||
An incomplete UserAgent is used to force CAPTCHA-solving. | ||
""" | ||
import sys | ||
from seleniumbase import SB | ||
|
||
agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/126.0.0.0" | ||
if "linux" in sys.platform: | ||
agent = None # Use the default UserAgent | ||
|
||
with SB(uc=True, test=True, rtf=True, agent=agent) as sb: | ||
url = "https://www.virtualmanager.com/en/login" | ||
sb.uc_open_with_reconnect(url, 4) | ||
sb.uc_gui_handle_cf() # Ready if needed! | ||
sb.assert_element('input[name*="email"]') | ||
sb.assert_element('input[name*="login"]') | ||
sb.set_messenger_theme(location="bottom_center") | ||
sb.post_message("SeleniumBase wasn't detected!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# seleniumbase package | ||
__version__ = "4.27.5" | ||
__version__ = "4.28.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.