0

I've wrote this script to login into Nike website, I get an selenium.common.exceptions.ElementNotInteractableException error because of pop-up message in the website when I try to login, I tried differents approches but nothing worked, here's my code :

import time
import requests
from selenium import webdriver

r = requests.get('https://www.nike.com/fr/launch?s=in-stock')

url = 'https://www.nike.com/fr/launch/t/air-max-90-pink-foam'

#accountINFO
uid = 'sss@gmail.com'
pwd = 'XXXX'


#boost browser
driver = webdriver.Chrome(executable_path = '//Users/xxxxxx/Desktop/chromedriver')
driver.get(url)
mcookis = driver.find_element_by_xpath("//button[@data-qa='accept-cookies']")
mcookis.click()
time.sleep(1)

memberLogin = driver.find_element_by_xpath("//button[@data-qa='top-nav-join-or-login-button']")
memberLogin.click()
time.sleep(1)

#Login
elem = driver.find_element_by_xpath("//input[@type='email']")
elem.send_keys(uid)

elem = driver.find_element_by_xpath("//input[@type='password']")
elem.send_keys(pwd)
login_submit = driver.find_element_by_xpath("//input[@value='CONNEXION']")
#time.sleep(1)
login_submit.click()

normally after submit is run I should access the site but instead I get an error message, when I type the pswd manually it's working.

habdie
  • 109
  • 7

2 Answers2

0

You need to handle Webdriver wait to get visible of element

Justin Lambert
  • 940
  • 1
  • 7
  • 13
0

Not sure I've got your problem. If the problem is the pop up, just use selenium to close it clicking on 'close' or 'x' and then search for the login button. Be also sure to wait some seconds before searching a new element, e.g.

driver.find_element_by_xpath('//*[@id="login"]').click(), time.sleep(5)
Ischio
  • 26
  • 1
  • 5
  • my problem is that when I try to login I get an error with a pop up that I want to close automaticlly but Can't figure out how to do it this is the full xpath for the error I want to close : `/html/body/div[2]/div/div/div[2]/div/div/div/div/div/div/div/div/div/div/div/div/div/div/div[8]/div/div[2]/input` – habdie Jun 23 '20 at 15:54
  • Clicking manually on the popup do you get access to the site? The problem is that you can't click the popup? Try looking the path while using interactive window. – Ischio Jun 23 '20 at 16:02
  • Yes it's working manually @Ischio – habdie Jun 23 '20 at 16:02