I'm new to Selenium WebDriver. I'm trying to automate a search function on a particular page.
There are a search input box and a search button (actually, it is a search icon) next to it. I'm able to identify the search box & enter (search) data into the box. But the problem is in identifying the search icon. Inspecting with Firebug shows it has 3 matching nodes. I see all 3 of them have identical attributes & values. The tag name indicates the search icon is an image file.
<img id="search-icon" style="width:auto; height:23px" onerror="this.onerror=null; this.src='/sites/all/themes/hjknewstheme/images/searchicon.png'" src="/sites/all/themes/hjknewstheme/images/gray_search.svg"/>
How can I get Selenium identify the locator for this element? I tried using ID & also customized XPath. Neither one is working. Any help in handling this issue would be greatly appreciated.
Here's the Xpath I used:
I also used
id as a locator. That didn't work either. Here's a snippet of the search icon.
The search icon image is at the beginning of my post.