I am attempting to use a CSS selector in Selenium to interact with a specific link, but it is failing to identify the correct one.
There are two occurrences of a link named "Cancel" on the page.
The xpath for the first instance of the Cancel link is:
//html/body/div[@id='c_account']/div[@id='a_returns']/div[@id='container']/div[@id='main']/div[@id='main_col']/div/div[@id='create-return']/div[1]/div/a[2]/span
The xpath for the second occurrence is:
/html/body/div[@id='c_account']/div[@id='a_returns']/div[@id='container']/div[@id='main']/div[@id='main_col']/div/div[@id='create-return']/div[4]/div/a[2]/span
Upon inspection of both links using Firebug, they have identical CSS paths.
html body.p div#c_account.c_wrapper div#a_returns.a_wrapper div#container div#main div#main_col div.main_content div#create-return div.return-process-actions div.return-process-action-buttons a.return-process-cancel
Due to the matching css paths, when I attempt to click on the second link with Selenium, it actually interacts with the first link.
Is there a method to differentiate between these two links using their CSS paths?