java - selenium very similar xpaths? -
i have 2 buttons on page have similar xpaths -
the button im trying click -
/html/body/div[@id='wrapper']/div[@id='content']/div[@id='contentarea']/div[@id='votecontent']/div[@id='votetext']/div[@id='voteboxes']/div[@id='votenow'][2]/form/input[2]
and other button im trying ignore -
/html/body/div[@id='wrapper']/div[@id='content']/div[@id='contentarea']/div[@id='votecontent']/div[@id='votetext']/div[@id='voteboxes']/div[@id='votenow'][1]/form/input[2]
the difference between 2 the
[@id='votenow'][1]
and
[@id='votenow'][2]
but can't figure out how interact 1 has votenow[2], whichever way go it, seems interact first 1 because that's first 1 finds
this java using firefox driver, suggestions great :)
just find them both , desired 1 index:
list<webelement> buttons = driver.findelements(by.xpath("your xpath")); webelement secondbutton = buttons.get(1);
Comments
Post a Comment