'How to clear "selenium.common.exceptions.ElementNotInteractableException" error?
I am a newbie to python so please excuse me. I have no background in programming, I am just trying things to smooth out something for me by automating.
I found other similar questions but my problem still persists after following some of the solutions posted.
I am trying to automate uploading files to a website, the website allows one file for upload at once, so I am trying to automate uploading the task of uploading one by one.
I am using selenium and I have progressed to logging in the page and attaching the file to upload. Now I am stuck as the website requires 3 tags to be inputted. There is one long field to input tags and is backed up by auto suggestion/complete. Cannot enter custom words, only those provided by website which is in auto suggestion.
The above error is displayed when I try to sendkeys() to that tag field element. Below is that element
[https://imgur.com/a/VGq7AtY]
I have tried Implicit wait and explicit wait as well but it doesn't work out, as seen below
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = webdriver.Firefox()
driver.implicitly_wait(30)
driver.get('https://www.website.com/login')
driver.find_element_by_xpath('//*[@id="app"]/div[1]/form/div[1]/div[2]/div[1]/input').send_keys('username')
driver.find_element_by_xpath('//*[@id="app"]/div[1]/form/div[1]/div[3]/div[1]/input').send_keys('password')
driver.find_element_by_xpath('//*[@id="app"]/div[1]/form/div[2]/button').click()
driver.find_element_by_xpath('/html/body/div/header/div[1]/span[2]').click() // upload page
driver.find_element_by_xpath('//*[@id="app"]/div[1]/div/div[1]/div[1]/div[1]/div[1]/label/input').send_keys('/home/userrobin/Desktop/file.html') // file to be uploaded path
time.sleep(10)
driver.implicitly_wait(40)
tags = WebDriverWait(driver, 40).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="tags-selector"]')))
# tags = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.XPATH, '//*[@id="tags-selector"]')))
tags.send_keys('assignment')
Error : selenium.common.exceptions.ElementNotInteractableException: Message: Element is not reachable by keyboard
What am I missing, what can I do to identify the problem? Thank you
EDIT
added
I tried with `
(By.XPATH, '//input[@id="tags-selector"]')
` , it gives is invalid: SyntaxError: Document.evaluate: The expression is not a legal expression Stacktrace: , I am not sure on how to refine locator to include //input
tried
driver.find_element_by_xpath('//*[@id="tags-selector"]/input').send_keys('assignment')
but it gave selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //[@id="tags-selector"]/input*
tried
driver.find_element_by_xpath('//*[@id="tags-selector"]').click()
this works on that field as now I can see the cursor in the field.
but when I try send_keys(), it shows me error not reachable by keyboard
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
