0
私はテスト自動化を学習しています。私はRuby言語で 'cucumber'、 'rspec'、 'selenium-web driver'フレームワークを使用しています。テストでは、ほとんどすべてのステップを実行することができました。ボタンのクリックを自動化するときにエラーが発生しました。未定義のメソッド 'click' - Webdriver
Step definitions:
Quando(/^clicar o botão "([^"]*)"$/) do |botaoSave|
# @navegador.find_elements(:xpath, "//*[@id='SAVE']").trigger("click")
@navegador.find_elements(:xpath, "//*[@id='SAVE']").click
end
エラーメッセージが表示:
E clicar o botão "SAVE" # features/step_definitions/criarConta.rb:92
undefined method `click' for #<Array:0x00000002847680> (NoMethodError)
./features/step_definitions/criarConta.rb:94:in `/^clicar o botão "([^"]*)"$/'
features/criarConta.feature:30:in `E clicar o botão "SAVE"'
Então a conta será cadastrada corretamente # features/criarConta.feature:31
Failing Scenarios:
cucumber features/criarConta.feature:7 # Cenário: Cadastrando uma conta
1 scenario (1 failed)
23 steps (1 failed, 1 undefined, 21 passed)
を返す、
find_element
を使用する必要があるのxpath、「//*[@id='SAVE']").click 不明なエラー:要素_form.action.value = '保存'; if(check_form( 'EditView');}};}}}}}}}}}}また、 ))SUGAR.ajaxUI.submitForm(_form); falseを返す; "ポイント(287、20)でtype = "submit" name = "button" value = "Save" id = "SAVE">をクリックできません。他の要素はクリックを受け取ります: –@DavidsonJacob実際のボタンがあなたの要素をカバーしているようですクリックしようとしています。 – Guy
コードを変更しましたが、別のエラーが表示されています @ navegador.find_element(:xpath、 "/ xpath、"/* [@ title = '保存'//ボタンをクリックしてください。//[編集]ボタンをクリックします。 ); _form.action.value = '保存'; if(check_form( 'EditView'))SUGAR.ajaxUI.submitForm(_form); falseを返します; "ポイント(287、20)でtype = "submit" name = "button" value = "Save" id = "SAVE">をクリックできません。 –