Update examples
This commit is contained in:
parent
4dcbf3c22f
commit
de75ec6135
|
@ -0,0 +1,19 @@
|
||||||
|
"""
|
||||||
|
UC Mode now has uc_gui_click_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_click_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!")
|
|
@ -1,11 +1,14 @@
|
||||||
from seleniumbase import SB
|
from seleniumbase import SB
|
||||||
|
|
||||||
with SB(uc=True, test=True, ad_block_on=True) as sb:
|
with SB(uc=True, test=True, ad_block=True) as sb:
|
||||||
url = "https://www.thaiticketmajor.com/concert/"
|
url = "https://www.thaiticketmajor.com/concert/"
|
||||||
sb.driver.uc_open_with_reconnect(url, 6.111)
|
sb.uc_open_with_reconnect(url, 6.111)
|
||||||
sb.driver.uc_click("button.btn-signin", 4.1)
|
sb.uc_click("button.btn-signin", 4.1)
|
||||||
sb.switch_to_frame('iframe[title*="Cloudflare"]')
|
sb.switch_to_frame('iframe[title*="Cloudflare"]')
|
||||||
sb.assert_element("div#success svg#success-icon")
|
if not sb.is_element_visible("svg#success-icon"):
|
||||||
|
sb.uc_gui_handle_cf()
|
||||||
|
sb.switch_to_frame('iframe[title*="Cloudflare"]')
|
||||||
|
sb.assert_element("svg#success-icon")
|
||||||
sb.switch_to_default_content()
|
sb.switch_to_default_content()
|
||||||
sb.set_messenger_theme(location="top_center")
|
sb.set_messenger_theme(location="top_center")
|
||||||
sb.post_message("SeleniumBase wasn't detected!")
|
sb.post_message("SeleniumBase wasn't detected!")
|
||||||
|
|
|
@ -3,9 +3,8 @@ from seleniumbase import SB
|
||||||
|
|
||||||
with SB(uc=True, test=True) as sb:
|
with SB(uc=True, test=True) as sb:
|
||||||
url = "https://gitlab.com/users/sign_in"
|
url = "https://gitlab.com/users/sign_in"
|
||||||
sb.driver.uc_open_with_reconnect(url, 3)
|
sb.uc_open_with_reconnect(url, 4)
|
||||||
if not sb.is_text_visible("Username", '[for="user_login"]'):
|
sb.uc_gui_click_cf()
|
||||||
sb.driver.uc_open_with_reconnect(url, 4)
|
|
||||||
sb.assert_text("Username", '[for="user_login"]', timeout=3)
|
sb.assert_text("Username", '[for="user_login"]', timeout=3)
|
||||||
sb.assert_element('label[for="user_login"]')
|
sb.assert_element('label[for="user_login"]')
|
||||||
sb.highlight('button:contains("Sign in")')
|
sb.highlight('button:contains("Sign in")')
|
||||||
|
|
Loading…
Reference in New Issue