gauge icon indicating copy to clipboard operation
gauge copied to clipboard

How to handle the page "Your connection isn't private" in taiko

Open poornadeem opened this issue 3 years ago • 11 comments

To Reproduce Steps (or project) to reproduce the behavior:

  1. when we open the URL we see the page as Your connection isn't private
  2. So while running the scripts in jenkins we see an issue.

image

while opening browser also i used: await openBrowser({ headless: headlessChrome, ignoreCertificateErrors: true, args: ['--no-sandbox', '--start-fullscreen', '--disable-web-security', '--disable-RendererCodeIntegrity'] })

poornadeem avatar Feb 01 '22 10:02 poornadeem

Any suggestions would be an great help?

poornadeem avatar Feb 01 '22 10:02 poornadeem

@saikrishna321 @sriv Any insight on this Please

poornadeem avatar Feb 03 '22 12:02 poornadeem

Are you able to open this page in chrome? taiko has an option for openBrowser to options.ignoreCertificateErrors which is true by default, but I suspect this error is not related to this setting

sriv avatar Feb 03 '22 13:02 sriv

yeah @sriv Earlier the jenkin setup was headless chrome is true when i am unable to handle this certificate. and also i am running my scripts in jenkins

So Now I am trying to run the scripts with headless mode is false,here is my output on jenkins [runner: 1] ## TC2 - Book Train & Non D & C EHI Car Rental

Failed to capture screenshot on failure. Error: Browser or page not initialized. Call openBrowser() before using this API WARNING: Browser or page not initialized. Call openBrowser() before using this API [runner: 1] Error Message: Error: Failed to launch browser! [0203/045120.618627:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2) [0203/045120.618696:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)

Stacktrace: 
Error: Failed to launch browser!
[0203/045120.618627:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0203/045120.618696:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)

    at onClose (node_modules/taiko/lib/browserFetcher.js:262:11)
    at ChildProcess.<anonymous> (node_modules/taiko/lib/browserFetcher.js:251:63)
    at ChildProcess.emit (events.js:326:22)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)

poornadeem avatar Feb 03 '22 13:02 poornadeem

@sriv headless_chrome = false is working fine on my local system.

poornadeem avatar Feb 03 '22 13:02 poornadeem

Sorry, I meant to ask what happens if you open the page outside the script (manually opening the webpage in chrome)?

Make sure you try the same url that your CI is using, some people use different URLs for every environment.

If the webpage's certificate has an issue, there is nothing taiko can do, so I suggest we rule that out first.

On jenkins, to run headless_chrome=false you may need to run it using xvfb.

sriv avatar Feb 03 '22 13:02 sriv

Some hints on the error are mentioned in Google Chrome's documentation - https://support.google.com/chrome/answer/6098869?hl=en#zippy=%2Cyour-connection-is-not-private-neterr-cert-authority-invalid-err-cert-common-name-invalid-neterr-cert-weak-signature-algorithm-err-certificate-transparency-required-or-ssl-certificate-error

sriv avatar Feb 03 '22 13:02 sriv

On jenkins, to run headless_chrome=false you may need to run it using xvfb.

What it meant @sriv ? I am not sure about this

poornadeem avatar Feb 03 '22 13:02 poornadeem

xvfb is a virtual frame buffer for the X server. The error you see is because the OS does not have a physical display and the process cannot render any content.

xvfb-run is a utility that can run commands in a virtual display, allowing you to run processes on cloud VMs/containers that do not have a display manager.

See https://github.com/getgauge/taiko/blob/master/.github/workflows/taiko.yml#L108-L114

for an example on how we do this to run taiko's functional tests

sriv avatar Feb 03 '22 13:02 sriv

I still recommend that you check that your test environment is setup and working properly, I suspect that the original certificate issue is likely an environment issue rather than a problem in your test code or taiko.

sriv avatar Feb 03 '22 13:02 sriv

Sure @sriv I will check with my team and get back to you

poornadeem avatar Feb 03 '22 13:02 poornadeem