5

I am using a Selenium module in Python to log into Quora. It works fine for Facebook, but I am getting an error on the send_keys('my_email') line while trying it on Quora:

I am using the following script.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

driver = webdriver.Firefox()
driver.get('http://www.quora.com/')
time.sleep(60)

username = driver.find_element_by_name('email')
time.sleep(60)
username.send_keys('my_email')
time.sleep(60)

password = driver.find_element_by_name('password')
time.sleep(60)
password.send_keys('my_password')
time.sleep(60)

password.send_keys(Keys.RETURN)

driver.close

Sleep time is not a problem here, because I tried executing a script line by line using the Python shell.

Error:

Traceback (most recent call last): File "", line 1, in password.send_keys('my_password') File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 293, in send_keys self._execute(Command.SEND_KEYS_TO_ELEMENT, {'value': typing}) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 370, in _execute return self._parent.execute(command, params) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 173, in execute self.error_handler.check_response(response) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 164, in check_response raise exception_class(message, screen, stacktrace) ElementNotVisibleException: Message: u'Element is not currently visible and so may not be interacted with' ; Stacktrace: at fxdriver.preconditions.visible (file:///c:/users/siddhesh/appdata/local/temp/tmpgwft3s/extensions/[email protected]/components/command_processor.js:8791:5) at DelayedCommand.prototype.checkPreconditions_ (file:///c:/users/siddhesh/appdata/local/temp/tmpgwft3s/extensions/[email protected]/components/command_processor.js:11438:1) at DelayedCommand.prototype.executeInternal_/h (file:///c:/users/siddhesh/appdata/local/temp/tmpgwft3s/extensions/[email protected]/components/command_processor.js:11455:11) at DelayedCommand.prototype.executeInternal_ (file:///c:/users/siddhesh/appdata/local/temp/tmpgwft3s/extensions/[email protected]/components/command_processor.js:11460:7) at DelayedCommand.prototype.execute/< (file:///c:/users/siddhesh/appdata/local/temp/tmpgwft3s/extensions/[email protected]/components/command_processor.js:11402:5)

1
  • Please include the complete traceback into the question. Commented Aug 29, 2014 at 13:53

1 Answer 1

6

The problem is that there are multiple inputs with name="email".

You need the one in the "Regular Login" section:

form = driver.find_element_by_class_name('regular_login')
username = form.find_element_by_name('email')
username.send_keys('my_email')

password = form.find_element_by_name('password')
password.send_keys('my_password')
Sign up to request clarification or add additional context in comments.

2 Comments

I think the problem in username.send_keys() line. Because as I said I tried executing it line by line in shell and it gives error at send_keys line.
Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> password.send_keys('my_email') File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 293, in send_keys self._execute(Command.SEND_KEYS_TO_ELEMENT, {'value': typing}) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 370, in _execute return self._parent.execute(command, params) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 173, in execute self.error_handler.check_response(response)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.