Selenium webdriver 未定义的方法“单击”-Webdriver

Selenium webdriver 未定义的方法“单击”-Webdriver,selenium-webdriver,rspec,automated-tests,cucumber,selenium-chromedriver,Selenium Webdriver,Rspec,Automated Tests,Cucumber,Selenium Chromedriver,我正在学习测试自动化。我正在使用Ruby语言中的“cumber”、“rspec”、“selenium web驱动程序”框架。在测试中,我几乎能完成每一步。自动单击按钮时出错 Step definitions: Quando(/^clicar o botão "([^"]*)"$/) do |botaoSave| # @navegador.find_elements(:xpath, "//*[@id='SAVE']").trigger("click") @navegador.find

我正在学习测试自动化。我正在使用Ruby语言中的“cumber”、“rspec”、“selenium web驱动程序”框架。在测试中,我几乎能完成每一步。自动单击按钮时出错

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_元素返回一个数组。您需要使用find_元素,它返回一个元素

@navegador.find_element(:xpath, "//*[@id='SAVE']").click

当我更改为:@navegador.find_元素:xpath,//*[@id='SAVE']时。单击未知错误:元素在第287、20点不可单击。其他元素将收到单击:@DavidsonJacob看起来实际按钮覆盖了您尝试单击的元素。尝试@navegador.find_元素:xpath,//*[@title='Save']。clickI更改了代码,但@navegador.find_元素:xpath,//*[@title='Save']显示另一个错误。单击未知错误:元素在第287、20点不可单击。