繁体   English   中英

mouse_move_to已淘汰的红宝石硒黄瓜

[英]mouse_move_to DEPRECATED ruby selenium cucumber

我是Selenium的新手,并且想要将鼠标悬停在“类别”按钮上,然后单击提供的下拉列表中的“子类别”。 我之前使用过'mouse_move to'命令,但现在它说:WARN Selenium [DEPRECATION] Driver#mouse已弃用。 请改用driver.action..perform。 我尝试将这段代码从“ mouse”更改为“ action”,将“ click”更改为“ perform”,但是它不起作用。

 element = $driver.find_element :xpath => "//span[@class = 'ls_2px' and text() = 'Accessories']"
  $driver.mouse.move_to element
 element = $driver.find_element :xpath => "(//div[@class = 'vt'][.//a[text() = 'View All']]//a[0])"
  element.click
 end

我是否需要将WebDriver :: W3CActionBuilder添加到我的环境文件中? 我只有这个:

require 'rubygems'
require 'selenium-webdriver'
require 'cucumber'
$driver = Selenium::WebDriver.for :chrome
$dropdown = Selenium::WebDriver::Support::Select

在这种情况下, driver.action.move_to(element).perform应该适用于Hover

资源: 类:Selenium :: WebDriver :: move_to - move_to

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM