I have some existing RSelenium code I am trying to get working with a Chrome Profile. I am using the code below to open a browser:
cprof <- getChromeProfile("C:/Users/Paul/AppData/Local/Google/Chrome/User Data", "Profile 1")
driver <- rsDriver(browser=c("chrome"), chromever="80.0.3987.106", port=4451L, extraCapabilities=cprof)
But when I run this, Three (3!) new Chrome browser windows open before the following error is displayed in RStudio:
Could not open chrome browser.
Client error message:
Summary: SessionNotCreatedException
Detail: A new session could not be created.
Further Details: run errorDetails method
Check server log for further details.
The puzzling part is that it does look like it is getting the correct profile, because when I switch between "Profile 1", "Profile 2" and even "Default" in the getChromeProfile call, I see the correct user icon in the browser windows that open. And if I leave off the extraCapabilities the browser opens with no problem (using the default "empty" profile).
Any idea what I am doing wrong?
Related
In a R/shiny project, I have to bring data from endpoint and often use RCurl to do it.
But in this case, the console prints a error about local certificate.
library(RCurl)
data = getURL("https://corporatewebsite.kl/ProyectosTD/getData/dfs32b98565sd65dfkjswfr8J")
Error in function (type, msg, asError = TRUE) : SSL certificate problem: unable to get local issuer certificate
So, I did some test. For example, using Mac computer this problem does not appear, however in shinyapps.io it does.
The problem is that RCurl doesn't get the certificate from the website, then we need to add this certificate like a parameter.
In order to get the certificate you need to follow this steps:
Open the broswer (I used firefox), then go to endpoint (or API) URL and click on the padlock icon.
Broswer + click on padlock icon
Then choose "More information" option, and you will find a button called "View Certificate" in the window that pops up, then click it!
Button Called "View Certificate" in website indetify window
In the new tab will open on your browser there is a section called "Miscellaneous" where you will find the links to download the pem files. Download them!
Miscellaneousd and links of pem files
Finally, add this files in your R project "Working directory" and add one of them like a parameter into getURL command (it is one of two).
library(RCurl)
data =getURL("https://corporatewebsite.kl/ProyectosTD/getData/dfs32b98565sd65dfkjswfr8J", cainfo="file.pem")
I want to use RSelenium to access and scrape a website each day. Something I've noticed is that when I open up the website in a regular chrome browser, I am already logged in from the last time I visited the website. However, if I use RSelenium to open up a remote driver, and visit the webpage using this driver, it does not have me logged into the website already. It's basic enough to log into most sites usually, however for this website there is a Captcha that makes logging in more difficult.
Is there anyway the remote driver can access the website with me already logged in?
Example of my code below:
this_URL = "my_url_goes_here"
startServer()
remDr = remoteDriver$new(browserName = 'chrome')
Sys.sleep(2); remDr$open();
Sys.sleep(4); remDr$navigate(this_URL);
login_element = remDr$findElement(using = "id", "login-link")
login_element$
After clicking the login_element link, it brings me to the page where I input my username, password, and click the captcha / do what it asks.
Thanks,
It should work using firefox and firefox profiles as follows:
Setup Firefxx Access:
Open firefox and login as usual. Make sure when you close firefox and you login again you stay logged in.
Figure out the location of your default firefox profile:
This should be somethink like: (source + more details)
Windows: %AppData%MozillaFirefoxProfilesxxxxxxxx.default
Mac: ~/.mozilla/firefox/xxxxxxxx.default/
Linux: ~/Library/Application Support/Firefox/Profiles/xxxxxxxx.default/
Start a new RSelenium driver and set the profile as follows
->
require(RSelenium)
eCap <- list("webdriver.firefox.profile" = "MySeleniumProfile")
remDr <- remoteDriver(browserName = "firefox", extraCapabilities = eCap)
remDr$open()
The firefox-window that opens should be your chosen profile.
I did this a while ago. If i remember correctly it works like this.
P.S.: You could also create an extra/new firefox profile for that. To do that follow the steps in the link above
It worked when I test it on local pc, user can login/logout without any problem.
Then I deploy the app on mobile using this command:
meteor run android-device --mobile-server myapp.herokuapp.com
Upon user clicks login on the mobile, Meteor.loginWithPassword returns this:
errorClass {error: 404, reason: "Method 'login' not found", details: undefined, message: "Method 'login' not found [404]", errorType: "Meteor.Error"}
What could be wrong with the 'login'? Why is it not found on the mobile?
Can anyone help please.
So it turned out my latest deployment to Heroku that contained accounts-password package was a bad build, therefore the app couldn't communicate to the server for a successful login. Fixed the error and re-deploy, now app is working normally. Facepalm
I'm using the RGoogleAnalytics package in a remote Desktop (in a different country), i'm not using my local machine since Google blocks my local machine due to restrictions.
In my local machine, when i run the 'Auth' command:
token <- Auth(client.id = "XXXXXXXXXXXXXXXXXXXXXXX",
client.secret = "YYYYYYYYYYY")
the browser automatically opens a new tab ("Request for permission") in the browser for me to accept (natural part of authentication) - This is what should happen, though when i'm doing it through my remote machine (where i'm logged into the GA account, how it should work), My R console just gets stuck with the following command, without automatically opening a new request for permission tab in the browser:
token <- Auth(client.id = "XXXXXXXXXXXXXXXXXXXXXXX",
client.secret = "YYYYYYYYYYY")
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Has anyone ran into this issue at the past? I've actually used this package quit a lot and never ran into this weird issue
Thanks in advance for any help on this one :)
I solved this by launching a browser remotely :
ssh user#server -Y firefox
...and launching Rstudio as if it was on localhost.
Just make sure you have a port for Google API authentication response (likely 1410) open for TCP
I ran
fb_oauth <- fbOAuth(app_id="XXXXX", app_secret="XXXXXX",extended_permissions = TRUE)
from RFacebook. I had added http/:1410 in siteurl and saved changes.
I waited for a few minutes and hit enter. A chrome page opened and asked if my app was allowed to access my information. I clicked on ok. But then the page as well as R console closed. The message from webpage was "Google Chrome's connection attempt to localhost was rejected"