Open sybrohee opened 8 months ago
Does it work if you navigate to http://my.insecure.app
instead (using http
instead of https
)?
It would have been so nice if it had been the case. Unfortunately, I just tested it and I get the same error. Thanks for your advice, though.
Bummer, but good news, I think I have a solution (or at least something to try). Chrome has an --ignore-certificate-errors
flag you can use. Try this code:
library(chromote)
chrome <- Chrome$new(
path = find_chrome(),
args = paste(default_chrome_args(), "--ignore-certificate-errors")
)
chromote <- Chromote$new(browser = chrome)
session <- ChromoteSession$new(parent = chromote)
session$parent$debug_messages(TRUE)
session$Page$navigate("https://my.insecure.app")
Hello. First of all, thank you for the time you spent looking to my problems.
Your solution helped me a lot but was not working immediately as I forgot to mention that I am working within a non privileged docker container.
When running you code. This is what I have :
Error in `with_random_port()`:
! Cannot find an available port. Please try again.
Caused by error in `startup()`:
! Failed to start chrome. Error: Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
[0320/140248.630175:FATAL:zygote_host_impl_linux.cc(202)] Check failed: . : Operation not permitted (1)
[0320/140248.636731:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0320/140248.636794:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Run `rlang::last_trace()` to see where the error occurred.
Working within a privileged container seemed to deliver the expected results if
library(chromote)
chrome <- Chrome$new(
path = find_chrome(),
args = paste( "--ignore-certificate-errors")
)
chromote <- Chromote$new(browser = chrome)
session <- ChromoteSession$new(parent = chromote)
session$parent$debug_messages(TRUE)
session$Page$navigate("https://my.insecure.app", timeout = 50000)
However, as I prefer not work within a privileged docker container, using the following seems the work (I know it is ugly, but after one week, this is the only solution that came to my mind)
library(chromote)
temp_file <- tempfile(pattern = "mychrome", fileext = ".sh", tmpdir = ".")
writeLines(c('#!/bin/bash', '/usr/bin/google-chrome --ignore-certificate-errors "$@"'), con = temp_file)
system(paste0("chmod +x ", temp_file))
chromote <- Chromote$new(browser = Chrome$new(path = temp_file))
session <- ChromoteSession$new(parent = chromote)
session$parent$debug_messages(TRUE)
session$Page$navigate("https://my.insecure.app", timeout = 50000)
I am pretty sure there are other ways to deal with my issue but at least, this will allow me to continue working.
I am usine chromote (in combination with R/Selenider) to develop automated tests for my Shiny application. I turns out that our application is hosted on a server that has a non secure SSL certificate, which causes the following error when using a very classical command :
In chrome, I can bypass this error by stating that I accept the certificate whatever error it contains. How would you do that with chromote?
I've been struggling a lot for 3 days, any insight would be much appreciated.