Failed to log into Quora using Selenium webdriver in Python

I am using Selenium module in Python to log into Quora. It works fine for Facebook, but I get an error in line send_keys('my_email')

when I try 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 times are not a problem here because I tried to execute the script one at a time using the Python shell.

Mistake:

Traceback (last call last): File ", line 1, at password.send_keys ('my_password') File" C: \ Python27 \ lib \ site-packages \ selenium \ webdriver \ remote \ webelement.py ", line 293, at 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, executed by 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 currently visible and therefore cannot interact with '; Stack traces: in the fxdriver.preconditions.visible file (file: /// c: / users / siddhesh / appdata / local / temp / tmpgwft3s / extensions /fxdriver@googlecode.com /components/command_processor.js: 8791: 5) in DelayedCommand.prototype.checkPreconditions_ (file: /// c: / users / siddhesh / appdata / local / temp / tmpgwft3s / extensions / fxdriver@googlecode.com /components/command_processor.js: 11438: 1) to DelayedCommand.prototype.executeInternal_ / h (file: /// c: / users / siddhesh / appdata / local / temp / tmpgwft3s / extensions / fxdriver@googlecode.com / components / command_processor.js: 11455: 11) to DelayedCommand.prototype.executeInternal_ (file: /// c: / users / siddhesh / appdata / local / temp / tmpgwft3s / extensions / fxdriver@google.com /components/command_processor.js: 11460 : 7) to DelayedCommand.prototype.execute / <(File: /// C: / users / siddhesh / appdata / local / temp / tmpgwft3s / extensions /fxdriver@googlecode.com /components/command_processor.js: 11402: 5)

+3


source to share


1 answer


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

.

You will need a section under 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')

      

+5


source







All Articles