Reputation: 21
'm using Chrome: 60.0.3112.101 64 bits, ChromeDriver 2.29.461571, selenium-webdriver: 3.4 and cucumber 2.4. I'm performing test automation, I'm using the Ruby language with the webdriver and cucumber frameworks in ubuntu 16.04. I can not automate clicking the button.Why is this happening? Or am I forgetting something? I am using the following code. Any help is appreciated.
Quando(/^clicar o botão "([^"]*)"$/) do |botaoSalvar| @navegador.find_element(:id, botaoSalvar).click end
E clicar o botão "SAVE"
# features/step_definitions/criarConta.rb:92
unknown error: Element <input title="Save" accesskey="a" class="button primary"
onclick="var _form = document.getElementById('EditView');
_form.action.value='Save'; if(check_form('EditView'))
SUGAR.ajaxUI.submitForm(_form);return false;" type="submit" name="button"
value="Save" id="SAVE"> is not clickable at point (287, 20).
Other element would receive the click:
<a href="#" id="grouptab_1" class="dropdown-toggle grouptab" data-toggle="dropdown">...</a>
(Session info: chrome=60.0.3112.101)
(Driver info: chromedriver=2.29.461571
(8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.10.0-33-generic x86_64)
(Selenium::WebDriver::Error::UnknownError)
./features/step_definitions/criarConta.rb:93: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
Upvotes: 0
Views: 409
Reputation: 21
I did not make it
Quando(/^clicar o botão "([^"])"$/) do |botaoSave| @navegador.find_elements(:xpath, "//[@id='SAVE']").trigger("click") end
E clicar o botão "SAVE" # features/step_definitions/criarConta.rb:92
undefined method `trigger' for #<Array:0x00000002bb1730> (NoMethodError)
./features/step_definitions/criarConta.rb:93: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
Upvotes: 0
Reputation: 7231
I sometimes encountered scenarios where the capybara driver would render the page differently from an actual browser, resulting in elements being obscured by others or rendered outside the viewport.
In these cases, calling .click
on them would result in errors like this one. Have you tried replacing .click
with .trigger("click")
? That usually did the trick for me.
Upvotes: 1