I using WatiN dll, i have a table and in each td i have link with <a> href =javascript:void(0) </a>
,i my case i have same href in all of them(they dont have class),i need to click on them all (they open new tr with data) ,and then save the html page,my problem to click on all of them , i can click on the first one like this
Frame frameBODY = browser.Frame(Find.ByName("BODY"));
frameBODY.Link(Find.By("href", "javascript:void(0)")).Click();
But i need to click on all links that have "href", "javascript:void(0)"
,i think i need you use ListCollection
but i new in WatiN and still cant find the way to do this.
Any ideas how click on all links with "href", "javascript:void(0)"
.
You can get all the links inside of frame body as below.
Frame frameBODY = browser.Frame(Find.ByName("BODY"));
LinkCollection links = frameBODY.Link;
foreach(Link link in links)
{
if(link.GetAttributeValue("href").Contains("javascript:void(0)"))
{
link.Click();
// TODO - Add logic here for saving the file.
}
}