如何使用RSelenium修复“元素不可点击”

问题描述

我使用RSelenium,试图填写表格并下载一个zip文件。 但是,我在选择下载文档所需的复选框时遇到问题。

我收到以下错误:“ RSelenium元素在点(x,y)不可点击,其他元素将获得点击”。

在广泛搜索之后,在RSelenium的上下文中,我只发现了一个有关此错误的问题。该错误是由弹出窗口引起的,但是我的页面没有显示任何弹出窗口,因此我不知道是什么原因引起的。

尽管针对我正在寻找的Python错误有多个答案,但我找不到RSelenium的答案。

您知道为什么我不能单击同意条款和条件的复选框吗?


#On my Linux terminal,I create the docker:
sudo docker run -d -p 4445:4444 -p 5901:5900 -v /home/john/test:/home/seluser/Downloads selenium/standalone-firefox-debug:2.53.1

#Then,in R:

library(RSelenium)
ePrefs <- makeFirefoxProfile(
  list(
    browser.download.dir = "/home/seluser/Downloads","browser.download.folderList" = 2L,"browser.download.manager.showWhenStarting" = FALSE,"browser.helperApps.neverAsk.saveToDisk" = "multipart/x-zip,application/zip,application/x-zip-compressed,application/x-compressed,application/msword,application/csv,text/csv,image/png,image/jpeg,application/pdf,text/html,text/plain,application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/octet-stream"))

mybrowser <- remoteDriver(extraCapabilities = ePrefs,port = 4445)
mybrowser$open()

url<-paste("http://www.cis.es/cis/opencms/EN/formulario.jsp?dwld=/Microdatos/MD3288.zip",sep="")

#start navigation
mybrowser$navigate(url)
wxbox<-mybrowser$findElement(using="id","Nombre")
wxbox$sendKeysToElement(list("FirstName"))

wxbox<-mybrowser$findElement(using="id","Apellidos")
wxbox$sendKeysToElement(list("LastName"))

wxbox<-mybrowser$findElement(using="id","profesion")
wxbox$sendKeysToElement(list("University"))

wxbox<-mybrowser$findElement(using="id","Email")
wxbox$sendKeysToElement(list("some_email@gmail.com"))

chkbox <- mybrowser$findElement(using = 'xpath',"//input[@name='objeto1'][@type='checkbox']")
chkbox$clickElement()

chkbox <- mybrowser$findElement(using = 'xpath',"//input[@name='Terminos'][@type='checkbox']")
chkbox$clickElement()
#But then I get an error right after this command:
#Selenium message:Element is not clickable at point (61.866668701171875,715.38330078125). Other element would receive the click: <label for="Terminos"></label>

#Just to make sure all the rest of the commands were working,I took a screen-shot
mybrowser$screenshot(display = TRUE) #as we can see,not even the first checkbox seemed to have worked,although I got no error for that one

#If it was not for the error,my plan was to continue like this:
donwload <- mybrowser$findElement(using = 'class',"button")
donwload$clickElement()

list.files("/home/john/test/") #hopefully,the zipfile would be here


有什么想法即使我没有弹出窗口也为什么得到此“元素不可点击”?如何使用RSelenium修复该问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...