0

i got a little problem with a website i want to automate the connection to.

I'm using python and selenium webdriver to try to connect to this site but can't achieve to finish it.

from selenium import webdriver

options = webdriver.ChromeOptions() 
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("--disable-blink-features")
options.add_argument("--disable-blink-features=AutomationControlled")
driver = webdriver.Chrome(options=options, executable_path=r'path\to\chromedriver.exe)

driver.get('https://www.zalando.com')

I already searched all around the internet to find a solution to my problem, but it looks like the site i'm trying to connect detects that i'm using webdriver and blocks me. Whenever i try to connect via my normal browser, everything works fine but with selenium i got an error when i press the connection button.

"An error has occurred. Do we start again later?"

I tried to use proxies but i'm not sure that it is the solution... I also tried the solutions proposed here :Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection But nothing looks like to work. The site i'm trying to connect to uses Akamai by the way.

Has anyone any solution ? Thanks for your time.

EDIT

I used right proxies and it's now working fine !

Arthur_S
  • 1
  • 1

1 Answers1

0

You need to revisit the options you add to Chrome, the following code works:

EDIT upon OPs clarification:

The following code will fill in the login form, then throw an error. It is expected to actually log you in, if you use the corect user/pass:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from bs4 import BeautifulSoup


chrome_options = Options()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")


webdriver_service = Service("chromedriver/chromedriver") ## path to where you saved chromedriver binary
browser = webdriver.Chrome(service=webdriver_service, options=chrome_options)

browser.get("https://accounts.zalando.com/authenticate")
WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, 'login.email'))).send_keys('hello')
WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, 'login.secret'))).send_keys('dolly')
login_button = browser.find_elements(By.TAG_NAME, 'button')[1]
login_button.click()
Barry the Platipus
  • 9,594
  • 2
  • 6
  • 30
  • Thanks for the answer, but i don't understand how this will help me with connecting to the website. Whenever i reach the connection page, it shows me the same error whatever my options are... – Arthur_S Jul 17 '22 at 18:37
  • What do you mean by 'connection page'? Are you able to access `zalando.com`? I would then suggest updating your setup - browser, chromedriver, selenium library. As I said above, I could connect with no issues. – Barry the Platipus Jul 17 '22 at 18:45
  • I can acces the website, and this page : https://accounts.zalando.com/authenticate but when i fill my email and password, i got the message error. I'll try to update everything though – Arthur_S Jul 17 '22 at 18:52
  • I think it detects that i'm using an automation tool and it blocks me – Arthur_S Jul 17 '22 at 22:07