我是Selenium的新手,我想将鼠标悬停在Category按钮上,然后单击提供的下拉列表中的子类别。我以前使用过'mouse_move to‘命令,但现在它显示:警告Selenium弃用Driver#mouse已弃用。请改用driver.action..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
发布于 2018-12-13 09:03:22
在这种情况下,对于Hover
,driver.action.move_to(element).perform
应该可以工作。
https://stackoverflow.com/questions/53464735
复制相似问题