1

I know there is proably an obvious anwser to this question but I'm trying to learn WatiN and can't figure it out my self :(.

My problem is i need to click a ListItem but i can't get it working as I'd like.

HTML:
<ul class="pageNavigation">
<li><a href="/users/dashboard">&#187; Dashboard</a></li>
<li><a href="/users">&#187; Profile</a></li>
<li><a href="/accounts/settings">&#187; Settings</a></li>

What I'm doing:

ListItem list = ie.List(Find.ByClass("pageNavigation")).ListItem(Find.ByIndex(1));
ie.Link(Find.ByText(list.ToString())).Click();

What I would like to be doing: Instead of getting the ListItem text i would like to get the ListItem href.

NOTE: ie.List(Find.ByClass("pageNavigation")).ListItem(Find.ByIndex(1)).Click(); doesn't work it just clicks the list item area and not the actual link.

Thanks for the help.

1 Answer 1

0

Perhaps it might help if you try to click the link itself:

ie.List(Find.ByClass("pageNavigation")).ListItem(Find.ByIndex(1)).Links[0].Click();

OR

ie.List(Find.ByClass("pageNavigation")).ListItem(Find.ByIndex(1)).Link(Find.Any).Click();
1
  • Thanks, that was exactly what i couldn't figure out :) Aug 17, 2011 at 14:09

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.