I have a problem trying to enter my username and password with Selenium WebDriver using Firefox on Windows, for some reason it does not allow me to enter the email and password, I have tried using elements such as: ID, CSS, Class... but it shows me the error message:
ElementNotInteractableException: Message: Element is not reachable by keyboard
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
# Driver Configuration
browser = webdriver.Firefox(executable_path=r'C:\geckodriver.exe')
browser.get('https://b2b.bluewaycorp.com/index.php/customer/account/login/')
time.sleep(4)
# Input User
username_el = browser.find_element_by_id("email")
username_el.send_keys('[email protected]') # ERROR WHEN I TRY TO INPUT TEXT!!
time.sleep(0.5)
# Input Password
password_el = browser.find_element_by_id("pass")
password_el.send_keys("password") # ERROR WHEN I TRY TO INPUT TEXT!!
time.sleep(0.5)
submit_btn_el2 = browser.find_element_by_xpath("/html/body/div[1]/main/div[3]/div/div[2]/div[1]/div[2]/form/fieldset/div[4]/div[1]/button/span")
time.sleep(1)
submit_btn_el2.click()
I would like to know what elements of the code I am missing to be able to enter the user and the mail, it is probable that first I will have to interact with the class both elements or use other functions from selenium
CodePudding user response:
There are more than one elements with the same property, that's why your code is not working:
for Email field, use this:
browser.find_elelment(By.XPATH, "(//input[@name='login[username]'])[3]").send_keys('[email protected]')
for Password field, use this:
browser.find_elelment(By.XPATH, "(//input[@name='login[password]'])[3]").send_keys('password')