Search code examples
watinanchorhref

Watin:Refering to href attribute of anchor tag under List item Tag


I am new to Watin Testing Tool. I am trying to automate my application.
But i am not able to find the Input Element ie anchor tag having href attribute .Anchor tag is under List item which is under div tag.

Please help


Solution

  • You have severall options:

    var link = browser.Link(Find.ByUrl("http://needs.to.be/exact/match.url"));
    

    or

    var link = browser.Link(Find.ByUrl(url => url != null && url.Contains("partial/match.url"));
    

    or I you want to find a url specifically inside a list item (as of WatiN 2.0.50):

    var link = browser.ListItem("listItemIdHere").Link(Find.ByUrl(url => url != null && url.Contains("partial/match.url"));