结合使用RSelenium和R中的循环在Web元素中添加迭代值条目

问题描述

我希望我能在这个问题上得到一些帮助:

我正在使用RSelenium从一个站点下载记录,该站点只能批量下载500个记录。我有大量记录要下载,因此如果可以做一个看起来像这样的循环,那就太好了这个伪代码

# step one
navigate to website
# step two
find and click on the webelement 'from'
# step three
enter value 1 in the 'from' element and 500 in the 'to' element (this uses the tab key to move from 'from' to 'to')
# step four
initiate file extraction sequence
# step five
clear the 'from' and 'to' boxes OR renavigate to page
#step six
repeat as above but with value 501 in the 'from' element and 1000 in the 'to' element and extract those files
# step seven
repeat to n

这是我想在其中添加循环的实际代码:

# this navigates to the website of interest.
remdr$navigate("somewebsite")

# here,my code clicks on the web element of interest
webElem4 <- remdr$findElement(using = "css selector","#markFrom") #selects the element for the first number
webElem4$clickElement() # clicks on that element

# this enters the values for the records to be downloaded. In this case 1 - 500
webElem4$sendKeysToElement(list("001",key = "tab","500")) # enters numbers into elements

# this is the sequence of clicks to download the data
webElem2 <- remdr$findElement(using = "css selector","#exportTypeName") # selects the type of file to export
webElem2$clickElement() # clicks on selectien
webElem3 <- remdr$findElement(using = "css selector","#exportButton") # exports selection
webElem3$clickElement()

解决方法

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

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

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