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
Post a Comment