1

I am trying to create a test that finds a specified link on a web page and clicks it. What I am attempting to do is search for the link by specifying the name/text of the link. Is there a way to create a hyperlink object solely by specifying this?

I can do the following to find the link by specifying the href property like this:

     BrowserWindow browser = BrowserWindow.Locate("Window Title");
     var hyperlink = new HtmlHyperlink(browser);
     hyperlink.SearchProperties.Add(HtmlHyperlink.PropertyNames.Href, "link.com");
     Mouse.Click(hyperlink);

But I want to do the same thing by specifying the text/name of the link.

Any help would be appreciated! Thanks

1 Answer 1

0

I solved it...

This finds the link based on the text:

    hyperlink.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, "text");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.