Ad Widget

Collapse

Website by Browser / --ignore-certificate-errors option for Chrome

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rich@974
    Junior Member
    • Oct 2024
    • 13

    #1

    Website by Browser / --ignore-certificate-errors option for Chrome

    Hi

    Using the Website for Browser template, I need to get screenshot and data from many websites/apps that run on local.
    Few of them are running in http and lack certificates (I'm not responsible for that)

    Using regular Seleniuym commands (in the selenium server) I can bypass the certificate warning, to get a screenshot, but using Zabbix's Browser tool,
    none of the
    Code:
    options.addArguments('--ignore-certificate-errors');
    types of arguments seems to be working

    going here tells me a few things about the Browser tool like this
    Code:
    { "browserName":"chrome", "pageLoadStrategy":"normal", "goog:chromeOptions":{ "args":[ "--headless=new" ] } },
    but is doesn't really help

    I also watched, few times, the THIS video... but I'm still stuck

    Anyone knows how to bypass the no SSL warning in Chrome, from the Website by Browser tempalte ?
  • rich@974
    Junior Member
    • Oct 2024
    • 13

    #2
    Any one ? Selenium allows to send chrome options like this
    Code:
    const { Builder } = require('selenium-webdriver');
    const chrome = require('selenium-webdriver/chrome');
    
    (async function openMySite() {
    // Set Chrome options to ignore SSL certificate errors
    let options = new chrome.Options();
    [B]options.addArguments('--ignore-certificate-errors');[/B]
    
    // Create a new instance of the Chrome browser, specifying the remote server
    let driver = await new Builder()
    .forBrowser('chrome')
    .setChromeOptions(options)
    .usingServer('http://<MYseleniumserverIP>:4445/wd/hub')
    .build();
    
    try {
    // Navigate to my target
    await driver.get('http://mylocalwebsite.com');
    
    // Keep the browser open for 10 seconds before quitting
    await driver.sleep(10000);
    } catch (err) {
    console.error('An error occurred:', err);
    } finally {
    // Ensure the browser quits properly to release the session
    await driver.quit();
    }
    })();
    So why can't we have that in the Zabbix Browser thing ?

    Comment

    • traq911
      Junior Member
      • May 2005
      • 17

      #3
      I struggled for a little while on this too. The magic that got it going for me was to set it in options.capabilities like this:

      Code:
      var options = new Browser.chromeOptions();
      
      options.capabilities.alwaysMatch['goog:chromeOptions'].args = [
          "--ignore-ssl-errors",
          "--ignore-certificate-errors",
      ];
      
      browser = new Browser(options);
      
      ...
      I use chromedriver directly, so you may need to adjust for Selenium's ability to target multiple browser types. See the documentation here for more insight. Some mention of how to ignore certificates in that documentation would be helpful since there are many devices that get deployed with self or corporate signed certs. I think this would be a common use case.

      Comment

      Working...