gpt4 book ai didi

RSelenium:无法运行示例代码

转载 作者:行者123 更新时间:2023-12-01 13:51:44 26 4
gpt4 key购买 nike

我是 RSelenium 的新手,在使用“Introduction Vignette”中的以下示例时遇到了问题:

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 上运行 Firefox,R 版本为 3.1.1 (2014-07-10)。编辑:也不适用于 R 版本 3.1.3 (2015-03-09)。

最佳答案

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

Important changes in this release:

  • Native events in Firefox relied on an API that Mozilla no longer provides. As such, fall back to synthesized events on recent Firefox versions.

需要 native 事件的方法目前不适用于最新版本的 firefox (36) 和 selenium 服务器 (2.45.0)

关于RSelenium:无法运行示例代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29065334/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com