Error when driver = Driver(uc = True)
hello. Starting yesterday, if you suddenly add uc=True, the browser opens during the driver initialization process, but does not do anything, and then an error occurs. In the past, the same phenomenon occurred with chrome_undetectable, so I switched to seleniumbse. Do you know why this phenomenon occurs?
Hello. I'm not sure what you had in your script, (or what error you saw specifically), but perhaps the issue is in how you made your script. Here's a sample one:
from seleniumbase import SB
with SB(uc=True) as sb:
sb.driver.get("https://nowsecure.nl/#relax")
sb.sleep(2)
if not sb.is_text_visible("OH YEAH, you passed!", "h1"):
sb.get_new_driver(undetectable=True)
sb.driver.get("https://nowsecure.nl/#relax")
sb.sleep(2)
if not sb.is_text_visible("OH YEAH, you passed!", "h1"):
if sb.is_element_visible('iframe[src*="challenge"]'):
with sb.frame_switch('iframe[src*="challenge"]'):
sb.click("area")
sb.sleep(4)
sb.activate_demo_mode()
sb.assert_text("OH YEAH, you passed!", "h1", timeout=3)
Use sb.driver to access the raw driver. The driver will close automatically after the with block ends.
There's also the Driver version (which is the format you were using). Here's a working sample script for that:
from seleniumbase import Driver
import time
driver = Driver(uc=True)
driver.get("https://nowsecure.nl/#relax")
time.sleep(6)
driver.quit()
from seleniumbase import Driver import time driver = Driver(uc=True) driver.get("https://nowsecure.nl/#relax") time.sleep(6) driver.quit()
I am using Drive Version. and driver = Driver(uc=True) <- this line make errors occured. first, chrome did not respond to driver server. and after few minutes chrome is restarting. finally chrome re opened but cloudflare know it is selenium. Thnks for your help!
I'm not sure what's happening on your end, but I'm not able to reproduce your issue. I would try with the regular SB version:
from seleniumbase import SB
with SB(uc=True) as sb:
sb.driver.get("https://nowsecure.nl/#relax")
sb.sleep(2)
if not sb.is_text_visible("OH YEAH, you passed!", "h1"):
sb.get_new_driver(undetectable=True)
sb.driver.get("https://nowsecure.nl/#relax")
sb.sleep(2)
if not sb.is_text_visible("OH YEAH, you passed!", "h1"):
if sb.is_element_visible('iframe[src*="challenge"]'):
with sb.frame_switch('iframe[src*="challenge"]'):
sb.click("area")
sb.sleep(4)
sb.activate_demo_mode()
sb.assert_text("OH YEAH, you passed!", "h1", timeout=3)
I'm not sure what's happening on your end, but I'm not able to reproduce your issue. I would try with the regular
SBversion:from seleniumbase import SB with SB(uc=True) as sb: sb.driver.get("https://nowsecure.nl/#relax") sb.sleep(2) if not sb.is_text_visible("OH YEAH, you passed!", "h1"): sb.get_new_driver(undetectable=True) sb.driver.get("https://nowsecure.nl/#relax") sb.sleep(2) if not sb.is_text_visible("OH YEAH, you passed!", "h1"): if sb.is_element_visible('iframe[src*="challenge"]'): with sb.frame_switch('iframe[src*="challenge"]'): sb.click("area") sb.sleep(4) sb.activate_demo_mode() sb.assert_text("OH YEAH, you passed!", "h1", timeout=3)
Thanks a lot! I will try your way.