PAGE:
<input type="submit" class="btn auth-button" value="Submit">
WATIR代码:
Then(/^I click on submit$/) do
browser.button(:class,"btn auth-button").click
end
例外:
Then I click on submit # Features/Step_definitions/ChefD.rb:178
element located, but timed out after 30 seconds, waiting for true condition on #<Watir::Button: located: true; {:class=>"btn auth-button", :tag_name=>"button"}> (Watir::Exception::UnknownObjectException)
./Features/Step_definitions/ChefD.rb:179:in `/^I click on submit$/'
features/Sanity_scenarios.feature:47:in `Then I click on submit'
帮助我如何识别这个元素?
答案 0 :(得分:0)
试试这个:
btn = @browser.button value: 'Submit'
btn.exists?
btn.click