【问题标题】:Click "Edit" button use selenium cucumber ruby单击“编辑”按钮使用硒黄瓜红宝石
【发布时间】:2014-11-06 01:46:02
【问题描述】:

我想更新个人资料中的工作、教育、基本信息、联系信息 (accounts.google.com)

我有文件“Testcases.feature”

场景:用户可以更新工作信息

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..."

我无法点击“编辑”按钮,因为站点中存在许多“编辑”按钮

当我运行cmd时:cucumber -r features features\Testcases.feature --> 出现如下错误:

然后我点击“编辑”按钮# features/step_ 定义/lib_web.rb:9 找不到“编辑”按钮 (Capybara::ElementNotFound) ./features/step_definitions/lib_web.rb:10:in /^I click on "(.*)" button$/ ' features\Testcases.feature:65:in然后我点击“编辑”按钮'

【问题讨论】:

  • 你用什么代码来选择编辑按钮?

标签: ruby selenium click cucumber


【解决方案1】:

如果有多个带有“编辑”标签的按钮,我建议添加新的步骤以单击使用选择器作为explained here,然后在您的故事中使用它,如下所示:

When I click within "#buttonId"

您可以将“#buttonId”替换为您认为更合适的任何其他选择器。

【讨论】:

    【解决方案2】:

    Within 如下所示

    within "#specific area" do
      click_button "edit"
    end
    

    【讨论】:

      猜你喜欢
      • 2019-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-22
      • 1970-01-01
      • 2016-01-16
      • 2013-06-17
      相关资源
      最近更新 更多