I'm trying to use selenium to log into Ingram Micro's website. My script works on other sites but when I try to use it on Ingram Micro I get this error/message:
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <input class="button button-primary" type="submit" value="Log in" id="okta-signin-submit" data-type="save"> is not clickable at point (365, 560). Other element would receive the click: <p class="cc_message">...</p>
Here is my script:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import time
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
url = "https://usa.ingrammicro.com/_layouts/CommerceServer/IM/Login.aspx?returnurl=//usa.ingrammicro.com/"
driver = webdriver.Chrome(options=chrome_options)
driver.get(url)
def login():
USERNAME = 'email'
PASSWORD = 'password'
driver.find_element_by_xpath("//input[@type='text']").send_keys(USERNAME)
driver.find_element_by_xpath("//input[@type='password']").send_keys(PASSWORD)
#driver.find_element_by_xpath("//input[@type='submit']").click()
html = driver.find_element_by_tag_name('html')
html.send_keys(Keys.END)
driver.find_element_by_link_text('I ACCEPT').click()
driver.find_element_by_id('okta-signin-submit').click()
def write():
with open('scraped.txt', 'w') as file:
file.write(str(soup))
login()
html = driver.page_source
soup = BeautifulSoup(html, 'html.parser')
try:
me = driver.find_element_by_id("login_help-about")
#links = soup.find_all("a")
#print(f"Found these links: {links}")
#write()
print(f"{me.text} Element found")
except NoSuchElementException:
print('Not found')
driver.quit()
Update
I added some suggestions.