質問

what is the right code to find the email input for https://accounts.google.com/ServiceLogin?

the html is <input id="Email" class="" type="email" spellcheck="false" value="" placeholder="Email" name="Email"></input>

I'm referencing https://pypi.python.org/pypi/selenium

from selenium import webdriver
browser = webdriver.Firefox()
browser.get('https://accounts.google.com/ServiceLogin?')

for elem = browser.find_element_by_name() i've tried:

elem=browser.find_element_by_name('input id="Email"')
elem=browser.find_element_by_name('input id="Email" class="" type="email" spellcheck="false" value="" placeholder="Email" name="Email"')
elem=browser.find_element_by_name('input id="Email" class=""')
elem=browser.find_element_by_name('id="Email" class="" type="email" spellcheck="false" value="" placeholder="Email" name="Email"')
elem=browser.find_element_by_name('id="Email" class=""')

none of these work.

役に立ちましたか?

解決

Try this:

elem=browser.find_element_by_name("Email")

find_element_by_name expects the value of the name in the line of HTML. So in the case of name="Email", you would give find_element_by_name("Email").

他のヒント

You can also try using the id of the tag

elem = browser.find_element_by_id("Email")
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top