Reputation: 156
my current problem is that Python can't locate my password box.
<input class="stylepwd" name="pws" size="12" maxlength="12" onkeypress="return stEnter(event,this);" autocomplete="off" type="password">
Thats all i tried to do, but it always say it cant locate that box
element = driver.find_element_by_name('pws')
element = driver.find_element_by_class_tag('stylepwd')
element = driver.find_element_by_id('') #Yea, thats obviously not working ^^'
element.send_keys('mypassword')
Maybe there's another way I can type in that password. As soon as the site is loading, the cursor is in the box. Can I do anything with this? (Thats the site: https://i.sstatic.net/QM7eE.jpg)
Python code: https://pastebin.com/3ydHwDkH
Upvotes: 0
Views: 123
Reputation: 327
If it is in iframe, try
iframe = driver.find_elements_by_tag_name("iframe")[0]
driver.switch_to_frame(iframe)
then
element = driver.find_element_by_name('pws')
Upvotes: 0
Reputation: 2233
You can do something like this :
elem = driver.find_element_by_xpath('//input[@class="stylepwd"]')
This will give you the element input
with class="stylepwd"
Upvotes: 1