**I tried to identity div element from a web page and click on it using watir **
PAGE:
<div class="account-buttons">
<a href="/account/register" class="signup1 action-button">Sign Up with Email</a>
<a href="/account/login" class="login1 action-button">Have an account? Log In</a>
</div>
Watir CODE:
Then(/^I signup with email$/) do
browser.button(text: "Sign Up with Email").wait_until_present.click
end
Then(/^I click on button with text "([^"]*)" in div identifier "([^"]*)"$/) do |arg1, arg2|
browser.buttons(:text, arg1).divs(:class, arg2).click
end
Exception:
timed out after 30 seconds, waiting for true condition on #<Watir::Button: located: false; {:text=>"Sign Up with Email", :tag_name=>"button"}> (Watir::Wait::TimeoutError)
./Features/Step_definitions/ChefD.rb:73:in `/^I signup with email$/'
features/Sanity_scenarios.feature:8:in `Then I signup with email'
Please help me how to handle this?
It's inside the link, div is the parent of that link,
So write this code
b.element(link: 'Sign Up with Email').click
Or
b.link(text: 'Sign Up with Email').click
It would work.