0

I've encountered the following issue: I am running a python script with selenium to log in on https://zalando-lounge.pl webpage, code used is pretty simple:

options = Options()
options.add_argument("--disable-blink-features")
options.add_argument('--disable-blink-features=AutomationControlled')
options.add_argument("--disable-extensions")
options.add_experimental_option('useAutomationExtension', False)
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_argument("user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko")
s = Service(
    'C:\\Users\\PC\\anaconda3\\envs\\zalando-bot\\Lib\\site-packages\\chromedriver_binary\\chromedriver.exe')
driver = wd.Chrome(options=options, service=s)    
driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
driver.implicitly_wait(1)

# Selenium Stealth settings
stealth(driver,
        languages=["pl-PL", "pl"],
        vendor="Google Inc.",
        platform="Win64",
        webgl_vendor="Intel Inc.",
        renderer="Intel Iris OpenGL Engine",
        fix_hairline=True,
        )

    driver.get('http://www.zalando-lounge.pl/')
    login_by_email_btn = driver.find_element(By.ID, 'topbar-cta-btn')
    login_by_email_btn.click()
    login_by_email_btn = driver.find_element(By.ID, 'sso-login-lounge')
    login_by_email_btn.click()
    form_email = WebDriverWait(driver, 25).until(EC.element_to_be_clickable((By.ID, 'form-email')))
    form_email.send_keys(constants.EMAIL)
    form_password = WebDriverWait(driver, 25).until(EC.element_to_be_clickable((By.ID, 'form-password')))
    form_password.send_keys(constants.PASSWORD)
    form_password.submit()`

after submitting the form, I am unable to log in because of the following error: HTTP 403

Before posting this question I've tried every solution from the thread: Can a website detect when you are using Selenium with chromedriver? with no results (changing cdc_ in chromedrive binary, manipulating with the navigator.webdriver, using undetected_chromedriver, using selenium stealth, adding userAgent and other options arguments).

Weird thing is that after the browser is launched by Selenium I can't log in even manually. For now, my only idea to bypass the problem is using the user data directory with saved cookies, where I'm already logged in and it seems to work, but I won't the login process to be automated as well.

I am using ChromeDriver 98.0.4758.48, Chrome 97.0.4692.71.

Did anyone encounter the following issue?

Muhammad Mohsin Khan
  • 1,444
  • 7
  • 16
  • 23

0 Answers0