Log In To Website Using RSelenium & phantomjs in R, Multiple Instances Of Class exist

前端 未结 1 400
时光取名叫无心
时光取名叫无心 2021-01-20 23:41

I am trying to log in to this page: https://www.optionslam.com/accounts/login/ using the code on this post as a starting point, Scrape password-protected website in R

I

1条回答
  •  暖寄归人
    2021-01-21 00:25

    Two options:

    Use findElements to get both buttons and click on the 2nd one:

    remDr$findElements("class name", "red-button")[[2]]$clickElement()
    

    or use another selector method as @SymbolixAU suggests and target the 2nd element directly:

    webElem <- remDr$findElement("css", ".red-button[value='Log in']")
    webElem$getElementAttribute("outerHTML")
    
    #[[1]]
    #[1] ""
    
    webElem$clearElement()
    

    0 讨论(0)
提交回复
热议问题