python - why is selenium webdriver not finding my element -


https://www.mykplan.com/participantsecure_net/termsandconditions.aspx doing find id/xpath/name , fail accept button. here latest effort

driver.find_element_by_xpath('//*[@id="accept"]').click() 

copied straight chrome web tool

the button located inside frame. given xpath correct inside frame. tested xpaths in chrome console , got:

in case of main page (https://www.mykplan.com/participantsecure_net/termsandconditions.aspx) xpath couldn't located:

$x('//*[@id="accept"]'); [] 

in case of frame contents (https://www.mykplan.com/participantsecure_net/termsandconditionsbottom.aspx) xpath found:

$x('//*[@id="accept"]'); [<input type=​"submit" name=​"accept" value=​"i agree" id=​"accept">​] 

in selenium, guess need switch frame before looking xpath. think web driver function

driver.switch_to_frame("framename")  

should help. in case, frame buttons called "bottomframe".


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -