我试图在函数中使用sendKeysToElement()
之类的方法。我的问题与this类似,但即使我将引用远程驱动器作为函数参数传递,我仍然会收到错误。在没有函数时执行此代码没有问题。
question <- "Which hormone concentrations are altered in patients with the Allan Herndon Dudley syndrome?"
searchMM <- function(x, remDr){
remDr$findElement("css","textarea")$clearElement()
remDr$findElement("css","textarea")$sendKeysToElement(list(x))
remDr$findElement("css", "#note > input[type='button']:nth-child(12)")$clickElement()
concept <- remDr$findElement("css","table:nth-child(31) pre")$getElementText()
remDr$goBack()
concept <- unlist(concept)
test <- unlist(str_split(concept, "\n"))
}
searchMM(x=question, remDr=remDr)
test
运行此功能后,当我尝试查看test
中的内容时,我得到Error: object 'test' not found
。就此而言,concept
也不存在。我做错了什么?
答案 0 :(得分:1)
Country Name Year Thousand of units
Belgium 2005 1,044,074
Belgium 2006 1,092,214
Belgium 2007 1,079,477
Bulgaria 2005 25,660
Bulgaria 2006 34,310
Bulgaria 2007 60,228
Czech Republic 2005 261,999
Czech Republic 2006 262,207
Czech Republic 2007 254,053