this morning I've been attempting to do what I thought was a very simple thing. I'm using Phantom JS and Selenium to get a webpage from a web server and get data from it. Unfortunately, I've been stuck on getting the path that a link points to. In the HTML file, this is the link I am trying to open.
<a ng-click="openExternal(app.latest_release.pbw_file)" class="">
Download PBW
</a>
How would I go about simulating a click on this? I've already tried using the top two solutions I've found while researching this issue, which are
IWebElement element = driver.FindElement(By.XPath("//*[@id=\"main-view\"]/section/article/ul[2]/li[4]/a"));
IJavaScriptExecutor executor = (IJavaScriptExecutor)driver;
executor.ExecuteScript("arguments[0].click();", element);
and
IWebElement element = driver.FindElement(By.XPath("//*[@id=\"main-view\"]/section/article/ul[2]/li[4]/a"));
element.Click();
When clicking this link, I only need the resulting URL. When clicking this link in a real web browser, it simply opens up a new tab with the link. Is making a new tab the problem, or am I just doing this wrong?
Here's the website I'm trying to get this data from. http://ift.tt/2ioElo5
Thanks!
Aucun commentaire:
Enregistrer un commentaire