R webshot package login and redirect: issue with selector

R webshot package login and redirect: issue with selector

Questions : R webshot package login and redirect: issue with selector

986

A tool we use has regular updates. To keep in4codes_phantomjs the screenshots in our documentation in4codes_phantomjs up-to-date, I would like to start using Rmd in4codes_phantomjs and the webshot package. A first step would in4codes_phantomjs be to be able to login (and next to redirect in4codes_phantomjs to the desired page).

Based on the example in the package I tried in4codes_phantomjs the code below to login, but this triggers in4codes_phantomjs an “element not found error”.

https://dev79379.service-now.com/login.do is in4codes_phantomjs the login page where I took the in4codes_phantomjs selectors https://dev79379.service-now.com/home in4codes_phantomjs would be one the urls of interest

So, I have two questions:

  1. what would be the correct selector to find in4codes_phantomjs the element?

  2. how can I redirect from login.do to /home?

     library(webshot) url <- "https://dev79379.service-now.com/home" fn <- tools::file_path_sans_ext(basename(url)) webshot(url, paste0(fn,".png"), useragent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36", eval = "casper.then(function() { // Enter username and password this.sendKeys('#user_name.form-control input[type="text""]'