Ruby/Capybara Selenium 在自动旋转的轮播中存储图像的 href 值
Ruby/Capybara Selenium storing the href value of an image in an auto-rotating carousel
任何人都可以帮助我 way/example 如何做到这一点?我是 Ruby 的新手,正在努力为此整理一些东西。
编辑:我想存储旋转过程中可能出现的所有 href 值并稍后打印它们。
不确定我是否 post 对原始问题没有足够的信息,或者还需要什么,但我已经弄清楚了,这是我的解决方案。
feat = {}
index = 0
all('.bordered').each {|a|
feat[index] = a[:href]
puts a[:href]
index+=1
}
bordered 是我想存储的 href 的 'a class' 部分。该行的格式如下,
一个 class="bordered" href="location of the image"
因为你想要所有将出现的图像的 hrefs,你可能想告诉所有你想要当前不可见的图像 - 所以
hrefs = all('.bordered', visible: :all, minimum: 1).map { |img| img[:href] }
任何人都可以帮助我 way/example 如何做到这一点?我是 Ruby 的新手,正在努力为此整理一些东西。
编辑:我想存储旋转过程中可能出现的所有 href 值并稍后打印它们。
不确定我是否 post 对原始问题没有足够的信息,或者还需要什么,但我已经弄清楚了,这是我的解决方案。
feat = {}
index = 0
all('.bordered').each {|a|
feat[index] = a[:href]
puts a[:href]
index+=1
}
bordered 是我想存储的 href 的 'a class' 部分。该行的格式如下, 一个 class="bordered" href="location of the image"
因为你想要所有将出现的图像的 hrefs,你可能想告诉所有你想要当前不可见的图像 - 所以
hrefs = all('.bordered', visible: :all, minimum: 1).map { |img| img[:href] }