mardi 30 novembre 2021

Issue finding html tag with package RSelenium in a specific website

I'm using RSelenium to do some webScraping on the website https://unicancer.sigaps.fr/. I want to rewiew my team sigaps points (for those who don't know, when you publish an article in a scientific magazine, you get points and the more you have points the more you will get acknowledged blablabla). I want to automatize, the collect of those data.

So i already used RSelenium on other website and it worked, but on this specific one i can't find the html tags with those function:

remDr$findElement(using = "xpath", value = "/html/body/div[1]/div/div[2]/form/table/tbody/tr[2]/td[2]/input")$sendKeysToElement(list(username))
remDr$findElement(using = "name", value = "mdp")$sendKeysToElement(list(password))

I tried with the xpath and the name tag but both don"t work. I can't find any of the page elements.

I get this error :

   Selenium message:no such element: Unable to locate element: 
   {"method":"xpath","selector":"/html/body/div[1]/div/div[2]/form/table/tbody/tr[2]/td[2]/input"}
   (Session info: chrome=96.0.4664.45)
   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: 'PD06B6F', ip: '10.208.107.111', os.name: 'Windows 10', os.arch: 'amd64', 
   os.version: '10.0', java.version: '1.8.0_261'
   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

When i'm looking on the page code with my browser I can idnetify the html elements:

<input name="login" class="text_box" type="text">

So the website have an issue and I need to solve the interaction problem between RSelenium and it.

Here my whole code (maybe it is a docker problems ? I don't really know what it is thought i'm not a web developer)

rD <- rsDriver(browser= "chrome", port = 3955L,chromever = "96.0.4664.45")
remDr <- rD[["client"]]
 
remDr$navigate("https://unicancer.sigaps.fr/")
 
remDr$screenshot(TRUE)
 
username <- "xyz"
password <- "lol93"
 
 
remDr$findElement(using = "xpath", value = "/html/body/div[1]/div/div[2]/form/table/tbody/tr[2]/td[2]/input")$sendKeysToElement(list(username))
remDr$findElement(using = "name", value = "mdp")$sendKeysToElement(list(password))
 
rD$server$stop()
remDr$close()
system("taskkill /im java.exe /f", intern=FALSE, ignore.stdout=FALSE)



Aucun commentaire:

Enregistrer un commentaire