1

I know there is already one other pretty similar question, but my is a bit different. The problem is, that you cant login into Nike by using Selenium. It worked along time for me, but somehow it stopped working. I was reading a bit about how to bypass that and came to the solution, to just use an older chrome version(I'm using chrome driver). That worked, how ever now its not again and Nike is again blocking the login. The old Version I was using, was 79. The new Version that did worked for me a long time ago and that is the newest Version right now is 90. This is my Code, that tried to login into Nike:

import time 
from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-blink-features")
chrome_options.add_argument("--disable-blink-features=AutomationControlled")
chrome_options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36")
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options = chrome_options)
driver.get("https://www.nike.com/login")
time.sleep(2)
email = driver.find_element_by_xpath('//input[@type="email"]')
email.send_keys("THE-EMAIL")
password = driver.find_element_by_xpath('//input[@type="password"]')
password.send_keys("THE-PASSWORD")
button = driver.find_element_by_xpath("/html/body/div[2]/div[3]/div[7]/form/div[6]/input")
button.click()

Does someone knows why its blocking selenium? I mean manually I can Login, so its not because of the Account.

apaderno
  • 28,547
  • 16
  • 75
  • 90
  • What do you mean by "_blocking the login_"? do you receive any error messages? – MendelG Apr 28 '21 at 20:21
  • The following is showing up: AN ERROR OCCURRED. We are unable to connect to our servers right now. Please try again later. GENERIC "0 - POST request to https://unite.nike.com/login blocked" – programming_for_fun Apr 28 '21 at 20:33
  • Try solutions from here. I got the same error. https://stackoverflow.com/a/62520191/12730112 – vitaliis Apr 29 '21 at 11:15
  • Thank you very much! Did one of the solutions worked for you? – programming_for_fun Apr 29 '21 at 23:27
  • Hey Guys, a little update of what i know about this Problem: Nike is using "Akamai" as its Bot-Protection. I dont exactly know if akamai itself is detecting selenium, but i think so. It seems like, that there is no way to hide selenium from akamai. Read more in next comment... – programming_for_fun May 02 '21 at 22:28
  • So im working right now at a solution, how to bypass akamai. There are some really hardcore guys (just search for akamai bypass on youtube) out there, that already bypassed it and made a, i think cookie generator, that generates cookies, which you can use to request a login on nike, without getting blocked from akamai. I dont really see trough that whole stuff right now either, but i think its really interesting and i will keep you guys updated. Best greetings – programming_for_fun May 02 '21 at 22:28

1 Answers1

0

The solution given by colossatr0n in this thread Can a website detect when you are using Selenium with chromedriver? worked for me. Here is a partial copy, the idea is to replace cdc_ with another string in order not to be detected:

vim /path/to/chromedriver

After running the line above, you'll probably see a bunch of gibberish. Do the following:

Replace all instances of cdc_ with dog_ by typing :%s/cdc_/dog_/g. dog_ is just an example. You can choose anything as long as it has the same amount of characters as the search string (e.g., cdc_), otherwise the chromedriver will fail. To save the changes and quit, type :wq! and press return. If you need to quit without saving changes, type :q! and press return.

I also had to update the line to get the button:

 button = driver.find_element_by_xpath("/html/body/div[4]/div[1]/div[1]/div[1]/div[7]/form/div[6]/input")    

Selenium managed to login!

Pierre
  • 1,182
  • 11
  • 15