Merge pull request #2967 from seleniumbase/handle-form-captchas
Handle update to form turnstiles
This commit is contained in:
commit
025572dc16
|
@ -4,10 +4,11 @@ with SB(uc=True, test=True, incognito=True, locale_code="en") as sb:
|
||||||
url = "https://ahrefs.com/website-authority-checker"
|
url = "https://ahrefs.com/website-authority-checker"
|
||||||
input_field = 'input[placeholder="Enter domain"]'
|
input_field = 'input[placeholder="Enter domain"]'
|
||||||
submit_button = 'span:contains("Check Authority")'
|
submit_button = 'span:contains("Check Authority")'
|
||||||
sb.driver.uc_open_with_reconnect(url, 2) # The bot-check is later
|
sb.uc_open_with_reconnect(url, 2) # The bot-check is later
|
||||||
sb.type(input_field, "github.com/seleniumbase/SeleniumBase")
|
sb.type(input_field, "github.com/seleniumbase/SeleniumBase")
|
||||||
sb.driver.reconnect(0.1)
|
sb.reconnect(0.1)
|
||||||
sb.driver.uc_click(submit_button, reconnect_time=4)
|
sb.uc_click(submit_button, reconnect_time=4)
|
||||||
|
sb.uc_gui_click_captcha()
|
||||||
sb.wait_for_text_not_visible("Checking", timeout=10)
|
sb.wait_for_text_not_visible("Checking", timeout=10)
|
||||||
sb.highlight('p:contains("github.com/seleniumbase/SeleniumBase")')
|
sb.highlight('p:contains("github.com/seleniumbase/SeleniumBase")')
|
||||||
sb.highlight('a:contains("Top 100 backlinks")')
|
sb.highlight('a:contains("Top 100 backlinks")')
|
||||||
|
|
|
@ -12,7 +12,7 @@ with SB(uc=True, test=True) as sb:
|
||||||
sb.click('span:contains("9:00 PM")')
|
sb.click('span:contains("9:00 PM")')
|
||||||
sb.highlight_click('input[value="AR"] + span')
|
sb.highlight_click('input[value="AR"] + span')
|
||||||
sb.click('input[value="cc"] + span')
|
sb.click('input[value="cc"] + span')
|
||||||
sb.scroll_to("div.cf-turnstile-wrapper")
|
sb.scroll_to('div[class*="cf-turnstile"]')
|
||||||
sb.uc_gui_handle_cf()
|
sb.uc_gui_handle_cf()
|
||||||
sb.highlight("img#captcha-success", timeout=3)
|
sb.highlight("img#captcha-success", timeout=3)
|
||||||
sb.highlight_click('button:contains("Request & Pay")')
|
sb.highlight_click('button:contains("Request & Pay")')
|
||||||
|
|
|
@ -3,13 +3,11 @@ from seleniumbase import SB
|
||||||
|
|
||||||
with SB(uc=True, test=True, disable_csp=True) as sb:
|
with SB(uc=True, test=True, disable_csp=True) as sb:
|
||||||
url = "https://steamdb.info/"
|
url = "https://steamdb.info/"
|
||||||
sb.driver.uc_open_with_reconnect(url, 3)
|
sb.uc_open_with_reconnect(url, 3)
|
||||||
sb.uc_click("a.header-login span", 4)
|
sb.uc_click("a.header-login span", 3)
|
||||||
if not sb.is_text_visible("Sign in", "button#js-sign-in"):
|
sb.uc_gui_click_captcha()
|
||||||
sb.driver.uc_open_with_reconnect(url, 3)
|
|
||||||
sb.uc_click("a.header-login span", 4)
|
|
||||||
sb.assert_text("Sign in", "button#js-sign-in", timeout=3)
|
sb.assert_text("Sign in", "button#js-sign-in", timeout=3)
|
||||||
sb.driver.uc_click("button#js-sign-in", 2)
|
sb.uc_click("button#js-sign-in", 2)
|
||||||
sb.highlight("div.page_content form")
|
sb.highlight("div.page_content form")
|
||||||
sb.highlight('button:contains("Sign in")', scroll=False)
|
sb.highlight('button:contains("Sign in")', scroll=False)
|
||||||
sb.set_messenger_theme(location="top_center")
|
sb.set_messenger_theme(location="top_center")
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
# seleniumbase package
|
# seleniumbase package
|
||||||
__version__ = "4.29.2"
|
__version__ = "4.29.3"
|
||||||
|
|
|
@ -812,6 +812,16 @@ def _uc_gui_click_captcha(
|
||||||
and driver.is_element_present("div.spacer div[style]")
|
and driver.is_element_present("div.spacer div[style]")
|
||||||
):
|
):
|
||||||
frame = "div.spacer div[style]"
|
frame = "div.spacer div[style]"
|
||||||
|
elif (
|
||||||
|
(
|
||||||
|
driver.is_element_present('[name*="cf-turnstile-"]')
|
||||||
|
or driver.is_element_present('[id*="cf-turnstile-"]')
|
||||||
|
)
|
||||||
|
and driver.is_element_present(
|
||||||
|
'form div div[style*="margin"][style*="padding"]'
|
||||||
|
)
|
||||||
|
):
|
||||||
|
frame = 'form div div[style*="margin"][style*="padding"]'
|
||||||
elif (
|
elif (
|
||||||
frame != "iframe"
|
frame != "iframe"
|
||||||
and driver.is_element_present(
|
and driver.is_element_present(
|
||||||
|
@ -1017,7 +1027,7 @@ def uc_gui_handle_cf(driver, frame="iframe"):
|
||||||
time.sleep(0.02)
|
time.sleep(0.02)
|
||||||
active_element_css = js_utils.get_active_element_css(driver)
|
active_element_css = js_utils.get_active_element_css(driver)
|
||||||
if (
|
if (
|
||||||
active_element_css == "div.cf-turnstile-wrapper"
|
active_element_css.startswith("div.cf-turnstile")
|
||||||
or active_element_css.startswith("div#PYMIw2")
|
or active_element_css.startswith("div#PYMIw2")
|
||||||
):
|
):
|
||||||
found_checkbox = True
|
found_checkbox = True
|
||||||
|
|
Loading…
Reference in New Issue