seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.95k stars 938 forks source link

nowsecure.nl detect seleniumbase #2079

Closed ahmedabdelhamedz closed 12 months ago

ahmedabdelhamedz commented 12 months ago

hello brother why when i open nowsecure.nl with SeleniumBase i t appear cloudflare capatsha ?

nowsecure.nl Checking if the site connection is secure

nowsecure.nl needs to review the security of your connection before proceeding.

mdmintz commented 12 months ago

Duplicate of https://github.com/seleniumbase/SeleniumBase/issues/2026#issuecomment-1692231662

ahmedabdelhamedz commented 12 months ago

Duplicate of #2026 (comment)

from seleniumbase import Driver
import time

driver = Driver(uc=True)
driver.get("https://nowsecure.nl/#relax")
time.sleep(6)
driver.quit()

i tried this code but give me the same result can you try it on your computer please ?

mdmintz commented 12 months ago

Works for me. Maybe your ip address is blocked already.

ahmedabdelhamedz commented 12 months ago

Works for me. Maybe your ip address is blocked already.

i dont think problem from ip becuase it is home resdential ip i tried to put the time.sleep(6) before visit the website it worked successfully

please how can i open link in incognito window and how i close the browser when i use Selenium base becuase i use sb.close() but didnt work for me

i appreciate your support thanks

mdmintz commented 12 months ago

For the sb version, use:

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(2)
    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.