0

I want to update information for Work, Education, Basic information, Contact Information in profile (accounts.google.com)

I have file "Testcases.feature"

Scenario: User can update information for Work

Given I launch "https://accounts.google.com" page
When I fill in "Email" with "abc123@gmail.com"
And I fill in "Passwd" with "abc@2013"
And I click on "signIn" button
And I click on "Edit profile" link
And I click on "Edit" button
Then I should see text "abc..."

I can't click "Edit" button because existing many "Edit" button in site

When i run cmd: cucumber -r features features\Testcases.feature --> Appear error below:

And I click on "Edit" button # features/step_ definitions/lib_web.rb:9 Unable to find button "Edit" (Capybara::ElementNotFound) ./features/step_definitions/lib_web.rb:10:in /^I click on "(.*)" button$/ ' features\Testcases.feature:65:inAnd I click on "Edit" button'

orde
  • 5,233
  • 6
  • 31
  • 33

2 Answers2

0

If there are more than one button with "Edit" label I would recommend adding new step for clicking using selector as explained here and then using it in your story like this:

When I click within "#buttonId"

You can replace "#buttonId" with any other selector you find more suitable.

Community
  • 1
  • 1
mbukowicz
  • 41
  • 1
0

Simply Use Within here as below

within "#specific area" do
  click_button "edit"
end
Vishal Aggarwal
  • 1,929
  • 1
  • 13
  • 23