PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 15, 2022

[FIXED] Why do I get this error when working with Selenium? And what is the solution?

 April 15, 2022     firefox, iframe, python-3.x, selenium, xpath     No comments   

Issue

I want create an account on ProtonMail.

But when I sign up, I select the user, but I can not send anything to it.

And it gives the following error:

ElementNotInteractableException: Message: Element is not reachable by keyboard. address page='https://account.protonmail.com/signup?language=en'

user=d.find_element_by_xpath('//*[@id="username"]')
print(user.tag_name)  # Is input
user.send_keys('username')  # Give an error

I also used Action Chains, but the problem was not solved.


Solution

There are 2 issues here:
2 elements located by //*[@id="username"] XPath
The element you want to access is inside iframe.
Try this:

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


wait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it(driver.find_element_by_xpath('//iframe')))
user=d.find_element_by_xpath('//body[@class="color-norm bg-norm sign-layout-container"]//*[@id="username"]')
user.send_keys('username')


Answered By - Prophet
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing