【发布时间】:2019-03-17 04:21:07
【问题描述】:
给定以下 WATIR 对象:
my_links["Reports"]
=> #<Watir::Anchor: located: true; {:tag_name=>"a", :index=>8}>
tag_name 很容易找回:
my_links["Reports"].tag_name
2018-10-12 12:29:00 INFO Watir <- `Verifying precondition #<Watir::Anchor: located: true; {:tag_name=>"a", :index=>8}># for tag_name`
2018-10-12 12:29:00 INFO Watir <- `Verified precondition #<Watir::Anchor: located: true; {:tag_name=>"a", :index=>8}>#assert_exists`
2018-10-12 12:29:00 INFO Watir -> `Executing #<Watir::Anchor: located: true; {:tag_name=>"a", :index=>8}>#tag_name`
2018-10-12 12:29:00 INFO Watir <- `Completed #<Watir::Anchor: located: true; {:tag_name=>"a", :index=>8}>#tag_name`
=> "a"
但是如何检索索引号?我可以看到它是整数8,但是我找不到返回它的方法。
【问题讨论】: