0

Watirのx-pathを介してjquery[+}ツリーをクリックしようとすると、次のエラーが発生します。引数の数が間違っています(3 for 1)(ArgumentError)

When /^Go to e-Care and search for the policy created$/ do

link = element_by_xpath(String("//{0}[contains(normalize-space(text()),{1})]", "a",`enter code here` "Actions"))
link_parent = link.element_by_xpath((".."))
plus_div = link_parent.element_by_class(("expandable-hitarea"))
plus_div.click

end
4

2 に答える 2

0

単一の引数が必要な場合に、複数の引数を String.new に渡しています。

element_by_xpath(String("//{0}[contains(normalize-space(text()),{1})]", "a",`enter code here` "Actions"))

例:

String.new("foo")
=> "foo"
String.new("foo", "bar")
=>  wrong number of arguments (2 for 0..1) (ArgumentError)
于 2013-01-12T16:36:28.620 に答える
0

Watir では、ステップは次のように記述されます。

When /^Go to e-Care and search for the policy created$/ do
  link = @browser.link(:text => "Actions")
  link_parent = link.parent
  plus_div = link_parent.element(:class => "expandable-hitarea")
  plus_div.click
end

これは、watir ブラウザー オブジェクトが@browserインスタンス変数に格納されていることを前提としています。

于 2013-01-15T15:25:02.170 に答える