Issue
I'm working on a script to download a textbook from a pdf site, however, when trying to enter the book into the search bar i get an error
selenium.common.exceptions.ElementNotInteractableException: Message: The target element is not interactable and could not be clicked
I've tried to solve this by using EC.element_to_be_clickable((By.XPATH, "//input[@type='text']"))
and using time.sleep(4)
nothing has worked, the search bar is in view as soon as the page loads, I tried using an additional time.sleep() for extra time to load, but it still says the element isn't interactable when it's right there
this is the code
driver.switch_to.new_window('tab')
driver.get('https://www.pdfdrive.com')
time.sleep(2)
driver.fullscreen_window()
# time.sleep(4)
EC.element_to_be_clickable((By.XPATH, "//input[@type='text']"))
bkSrch = driver.find_element(By.XPATH, "//input[@type='text']")
bkSrch.send_keys(bookLnk)
time.sleep(2)
bkSrch.send_keys(Keys.SPACE + bookRthr)
`
I also tried clicking the element first and it still doesn't work
I have no other idea of what to do
Solution
EC.element_to_be_clickable((By.XPATH, "(//input[@type='text'])[2]"))
bkSrch = driver.find_element(By.XPATH, "(//input[@type='text'])[2]")
bkSrch.send_keys(bookLnk)
wait = WebDriverWait(driver, 30)
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,".fas.fa-times"))).click()
time.sleep(2)
bkSrch.send_keys(Keys.SPACE + bookRthr)
Just click the popup like so also your text search bar was using the wrong input tag.
Answered By - Arundeep Chohan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.