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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -