Selenium can’t open a second page

options.add_experimental_option(
    "excludeSwitches", ['enable-automation'])

options.add_argument(
    "user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36")
options.add_argument("--remote-debugging-port=9222")

driver = webdriver.Chrome(options=options)
driver.get(
    "https://www.justdial.com/Chennai/Hr-Consultancy-Services/nct-10258625/page-2")
driver.set_page_load_timeout(30)
driver.get(
    "https://www.justdial.com/Chennai/Hr-Consultancy-Services/nct-10258625/page-3")

the website is detecting automation use above code 🙂

You can also do this in single line

Just add below argument:

options.add_argument('--disable-blink-features=AutomationControlled')

disabling enable-automation , or disabling automation controller disables webdriver.navigator which few websites uses to detect automation scripts

Leave a Comment