Skip to content

Commit a88dc45

Browse files
committed
Add an example of bypassing hCaptcha
1 parent d488f21 commit a88dc45

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""(Bypasses the Imperva/Incapsula hCaptcha)"""
2+
from seleniumbase import SB
3+
4+
with SB(uc=True, test=True) as sb:
5+
url = (
6+
"https://www.gassaferegister.co.uk/gas-safety"
7+
"/gas-safety-certificates-records/building-regulations-certificate"
8+
"/order-replacement-building-regulations-certificate/"
9+
)
10+
sb.activate_cdp_mode(url)
11+
sb.sleep(0.6)
12+
sb.solve_captcha()
13+
sb.sleep(1)
14+
sb.wait_for_element("#SearchTerm", timeout=5)
15+
sb.sleep(2)
16+
allow_cookies = 'button:contains("Allow all cookies")'
17+
sb.click_if_visible(allow_cookies, timeout=2)
18+
sb.sleep(1.2)
19+
sb.press_keys("#SearchTerm", "Hydrogen")
20+
sb.sleep(0.5)
21+
sb.click("button.search-button")
22+
sb.sleep(3)
23+
results = sb.find_elements("div.search-result")
24+
for result in results:
25+
print(result.text.replace(" " * 12, " ").strip())
26+
print()
27+
sb.scroll_to_bottom()
28+
sb.sleep(1)

0 commit comments

Comments
 (0)