How can I find an anchor element that is associated to an image using Selenium Web Driver in C#

Here is my current code which is not able to find the element

[FindsBy(How = How.XPath, Using = “a[@href=’/apps/PriceDiscovery/Admin’]”)]
public IWebElement adminButton { get; set; }

Here is the html portion of the page that has the element being searched for

<a title=”View Administration Dashboard” href=”/apps/PriceDiscovery/Admin”><img width=”42″ height=”42″ title=”View Administration Dashboard” alt=”View Administration Dashboard” src=”/apps/PriceDiscovery/Content/Images/AccordionMenu/lock_white.png”></a>

Default Asked on May 30, 2017 in Selenium WebDriver.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.