Selenium element not visible Python

0

I am trying to log in to a site urgently through Selenium. All the sites in which I try to log in I could except this one. After putting this part of the code shows me a Python 2.7 error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 350, in send_keys
    'value': keys_to_typing(value)})
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 499, in _execute
    return self._parent.execute(command, params)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 297, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
  (Session info: chrome=61.0.3163.100)
  (Driver info: chromedriver=2.32.498537 (cb2f855cbc7b82e20387eaf9a43f6b99b6105061),platform=Mac OS X 10.12.6 x86_64)

Code:

# coding=utf-8


from selenium import webdriver


driver = webdriver.Chrome('/Users/Martin/Desktop/chromedriver')
driver.get("https://car.com")
user= driver.find_element_by_xpath('//*[@id="onevideo_login_username"]')
user.send_keys("email")

Here I enclose what I inspect:

<input type="text" id="onevideo_login_username" name="adaptv_email" data-i18n-placeholder="login.username" ng-model="models.login.email" class="ng-pristine ng-valid" placeholder="Username">

As I said before, doing this same process I could log in all the sites but I do not understand why it does not leave me.

Greetings

    
asked by Martin Bouhier 04.10.2017 в 19:36
source

1 answer

0

When an element is not visible but you can get the xpath and it works, in a tool like firepath , for example, the problem is usually that the input is included in an iframe or something similar.

If so, you have to change to the corresponding frame and then search for the element.

    
answered by 05.10.2017 в 09:38