Open MateusSanchesRodriguez opened 1 week ago
I patched headless mode of Undetected Chromedriver and NoDriver into https://github.com/seleniumbase/SeleniumBase.
(See the UC Mode and CDP Mode docs.)
Lots of updates, such as an ad-block option, etc.
Here's a script for headless mode: (After pip install seleniumbase
)
from seleniumbase import SB
with SB(uc=True, test=True, headless=True, ad_block=True) as sb:
url = "https://www.browserscan.net/bot-detection"
sb.activate_cdp_mode(url)
sb.cdp.flash("Test Results")
sb.cdp.assert_element('strong:contains("Normal")')
sb.sleep(0.5)
sb.cdp.save_screenshot("bscan.png")
when I run my code with headless turned off it works perfectly, but when I run it with headless it can't find the elements, I asked it to save the html of the page that headless is locking and it returns to the captcha page, so I assume it's not managing to solve the captcha in headless mode, does anyone have a solution?
options = uc.ChromeOptions()
options.add_argument('--no-sandbox') # Bypass OS security model