These are chat archives for cucumber/cucumber-ruby

8th
Aug 2016
Raga Pinilih
@ragapinilih
Aug 08 2016 13:52
Hello Guys..
blueice349
@blueice349
Aug 08 2016 15:27
Hey
blueice349
@blueice349
Aug 08 2016 16:35
Im trying to create a custom step, but for some reason my xpath method is not working as thought can someone see what I did wrong?
def getButtonElementByValue( value )

   return $driver.find_element( :xpath, '//input[@value="' + value + '"]' )
end
Then(/^I click a button labeled "([^"]*)"$/) do |value|

  button_element = getButtonElementByValue( value )
    click( 'id', button_element.attribute( 'for' ) )
end
Feature: Click on button

    Scenario: Click on button called Save Settings
        Then I click a button labeled "Save Settings"
Error I get:
Then I click a button labeled "Save Settings" # features/automation_test/general/step_definitions/forms.rb:20
no such element: Unable to locate element: {"method":"id","selector":""}
(Selenium::WebDriver::Error::NoSuchElementError)
./features/automation_test/general/step_definitions/forms.rb:23:in /^I click a button labeled "([^"]*?)"$/' features/automation_test/user_management/user_permissions/billing_agent/changeOwnUsername.feature:9:inThen I click a button labeled "Save Settings"'