1

I need to make a login script for the website https://cbdbene.com/

Login Page

but when I try to send Keys to the email field, I get the error

selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

I have tried using,

login_email = browser.find_element_by_xpath("//input[@id='login_email']")
driver.execute_script("argument[0].setAttribute('value', '[email protected]');", login_email)

but that is also of no help,

Even clicking the element has no response,

login_email = browser.find_element_by_xpath("//input[@id='login_email']")
driver.execute_script("argument[0].click();", login_email)

I don't know how to fill this form. Can someone please explain me what am I doing wrong here ?

2 Answers 2

1

Try below solution :

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait



driver = webdriver.Chrome(executable_path=r"C:\New folder\chromedriver.exe")
driver.maximize_window()
wait = WebDriverWait(driver, 50)
driver.get("https://cbdbene.com/")



warning = wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='modal-dismiss']//i//*[local-name()='svg']")))
driver.find_element_by_tag_name('body').send_keys("Keys.ESCAPE")

warning.click()


loginIcon = wait.until(EC.element_to_be_clickable((By.XPATH, "//li[3]//span[1]//div[1]//div[1]//*[local-name()='svg']")))
loginIcon.click()

inputBox = wait.until(EC.element_to_be_clickable((By.XPATH, "//div[4]//div[1]//div[1]//div[1]//div[1]//div[1]//div[1]//div[1]//span[1]//input[1]")))
inputBox.send_keys("Username")

Output:

enter image description here

Sign up to request clarification or add additional context in comments.

5 Comments

Trying the above solution raises selenium.common.exceptions.ElementClickInterceptedException.
Can you please elaborate your issue? your site taking too long to load if you are facing any TimeoutException then change WebDriverWait as per your convenient time
@kunal: check updated solution to stop page loading and its working fine foor me
Yes, now it's working fine. I don't know why, when I use the XPATH //*[@id="login_email"], it does not work, but using the full XPATH, it works fine.
because its returning list of elements
0

If you use absolute xpath you will see 3 inputs elements are there with same property. Induce WebDriverWait() and element_to_be_clickable() and use valid xpath.samething you have do with password.

from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait

driver=webdriver.Chrome()
driver.get("https://cbdbene.com/")
WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"div.modal-dismiss"))).click()
WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"li.c-nav__list-item>span.c-nav__link"))).click()
WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.XPATH,"(//input[@id='login_email'])[last()]"))).click()
WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.XPATH,"(//input[@id='login_email'])[last()]"))).send_keys("user name")

Browser snapshot:

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.