Python - Issues with selenium button click using XPath -
i'm using following code click button on page xpath keeps changing code keeps breaking:
mydriver.find_element_by_xpath("html/body/div[2]/div[3]/div[1]/div/div[2]/div[2]/div[4]/div/form[2]/span/span/input").click()
is there better way should doing this? here code button trying click:
<input class="a-button-input" type="submit" title="button 2" name="submit.button2-click.x" value="button 2 click"/>
xpath intelligent. more simple search that:
mydriver.find_element_by_xpath("//input[@name='submit.button2-click.x']")
which tells: search input
elements name
equals 'submit.button2-click.x'
element of choice.
don't forget try firefix xpath checker add-on before going code.
Comments
Post a Comment