首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用RSelenium输入ESPN登录信息

使用RSelenium输入ESPN登录信息
EN

Stack Overflow用户
提问于 2022-08-08 18:50:34
回答 1查看 37关注 0票数 1

我试图通过Selenium在R中将文本输入弹出式窗口,但似乎找不到该在哪里做它。

代码语言:javascript
复制
library(RSelenium)

rD <- rsDriver(browser="firefox", port=4545L, verbose=F)
remDr[["client]]

remDr$navigate("http://www.espn.com/login")

下一步真的把我搞糊涂了。基本上,当我尝试使用remDr$findElements(using = "xpath", value = "...")时,我没有运气。在检查页面时,我尝试从开发人员工具复制xpath,但得到了以下内容:

代码语言:javascript
复制
un_enter <- remDr$findElement(using = "xpath", "/html/body/div[1]/div/div/section/section/form/section/div[1]/div/label/span[2]/input")

Selenium message:Unable to locate element: /html/body/div[1]/div/div/section/section/form/section/div[1]/div/label/span[2]/input
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'LAPTOP-06J6R94A', ip: '192.168.1.167', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_341'
Driver info: driver.version: unknown

Error: Summary: NoSuchElement
  Detail: An element could not be located on the page using the given search parameters.
  class: org.openqa.selenium.NoSuchElementException
Further Details: run errorDetails method

这可能是因为这些信息在弹出窗口吗?

EN

回答 1

Stack Overflow用户

发布于 2022-08-08 19:20:03

我自己已经想出来了!我没有叫正确的iframe。通过以下方法解决了这一问题:

代码语言:javascript
复制
webElem <- remDr$findElement("css", "iframe")
remDr$switchToFrame(webElem[[1]])

# code normally from here
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73282719

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档