**私は**Ruby Watir Webdriver - divタグの要素を特定してクリックするにはどうすればいいですか?
PAGE Webページから身元div要素にしようとしたワチールを使用して、それをクリックしてください:
<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>
ワチールの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
を例外:
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'
どうすれば対応できますか?
あなたはなぜか、しかし、 "(私はテキストのボタンをクリックして"([^ "] *)"のような 'ユニバーサルステップ'のように、キュウバーグーグルグループとチャットすることができます " ] *) "$ /)do | arg1、arg2 |"キュウリの臭いです。そのステップは具体的な実装には欠けており、何が起こっているのかをよく表現していません。強く "キュウリの本"を取得し、読むことをお勧めします –