我是RSelenium
的新用户,我在“简介小插图”中遇到以下示例时出现问题:
remDr$navigate("http://www.r-project.org") # Works
webElem <- remDr$findElement("partial link text", "download R") # Works
webElem$getElementText() # Works
remDr$mouseMoveToLocation(webElement = webElem) # DOES NOT Work!
我收到以下错误:
Error: Summary: InvalidElementState
Detail: An element command could not be completed because the element is in an invalid state (e.g. attempting to click a disabled element).
class: org.openqa.selenium.InvalidElementStateException
有什么想法吗? 我在Mac OS X上使用R版本3.1.1(2014-07-10)运行Firefox。 编辑: 也不适用于R版本3.1.3(2015-03-09)。
答案 0 :(得分:2)
library(RSelenium)
startServer()
# remDr <- remoteDriver(browserName = "chrome")
remDr <- remoteDriver()
remDr$open()
remDr$navigate("http://www.r-project.org") # Works
webElem <- remDr$findElement("partial link text", "download R") # Works
webElem$getElementText() # Works
检查版本:
> remDr$getStatus()$build
$version
[1] "2.45.0"
$revision
[1] "5017cb8"
$time
[1] "2015-02-26 23:59:50"
> remDr$sessionInfo$version
[1] "36.0.1"
运行:
remDr$mouseMoveToLocation(webElement = webElem) # DOES NOT Work!
复制错误
检查错误消息:
remDr$value$localizedMessage
[1] "Cannot perform native interaction: Could not load native events component.\nBuild info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'\nSystem info: host: 'JACK2', ip: '192.168.59.3', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_25'\nDriver info: driver.version: unknown"
我们发现moveToLocation
方法需要nativeEvents。检查CHANGELOG的selenium服务器版本2.45.0,我们看到:
v2.45.0
此版本中的重要更改:
- Firefox中的本机事件依赖于Mozilla不再提供的API。因此,回到最近的Firefox上的综合事件 版本
最新版本的firefox(36)和selenium server(2.45.0)目前无法使用本机事件的方法