I am new to Selenium and I have the following situation.
My html:
<div class="activeThumbnail thumbnail simple animated zoomIn" data-url="/report/sales-vs-price" style="height: 332px;">
<div class="caption">
<p class="thumbReportTitle">
<a href="/report/sales-vs-price">Sales vs Price</a>
</p>
</div>
</div>
I need to simulate a click in the link so it opens the report page. I tried a couple of different options based on different responses (trying to access the link or the text):
1. This throws an exception of "element not visible"
driver.FindElementByCssSelector("a[href*='sales-vs-price']").Click();
2. Here I tried to fix the "not visible" exception so now it doesn't throw an error but it also doesn't do anything:
Actions builder = new Actions(driver);
Actions click = builder.MoveToElement(driver.FindElementByCssSelector("a[href*='sales-vs-price']")).Click();
click.Build().Perform();
or
Actions builder = new Actions(driver);
Actions click = builder.MoveToElement(driver.FindElementByXPath("//*[contains(text(),'Sales vs Price')]")).Click();
click.Build().Perform();
3. This throws an expception of "Unable to locate element"
driver.FindElementByPartialLinkText("a[href='sales-vs-price']").Click();
4. Or this, with the exception: "element not visible":
driver.FindElementByXPath("//*[contains(text(),'Sales vs Price')]").Click();
I am not sure what I am doing wrong... Does any one know if I can access data-url? Or does someone have any other ideas?
Thanks!