I am new to Watir WebDriver. I was playing around with this framework and I included the below code but the second line is not working
$b = Watir::Browser.new :ie #browser
$b.goto "www.yahoo.com"
$b.link(:text => "Sign up").when_present.click
I dont know why it is not getting the sign up link. I saw the source on Yahoo and it is as follows
<span class="tab-caption small y-txt-2">New here? <a href="http://hsrd.yahoo.com/_ylt=A2KLtVHgLNtQHnMBTk.bvZx4/SIG=13tjppi7u/EXP=1356627552/**https%3A//edit.yahoo.com/registration%3F.src=fpctx%26.intl=us%26.done=http%253A%252F%252Fwww.yahoo.com%252F" class="y-link-1">Sign Up</a></span>
What is the problem with my code? I also tried without when_present and it says the element is not visible.
Locating elements via text is case-sensitive.
Since the link says “Sign Up”, your locator also needs to say “Sign Up” (not “Sign up”):
Note that if you want to make the locator case-insensitive, you can use a regular expression with the ignore case modifier: