0

I'm trying to set some specific capabilities for a Selenium Webdriver.

In this example i want to change a capability of the webdriver for the Firefox browser. I'm trying to this in Javascript.

this.driver = new selenium.Builder().forBrowser('firefox').build();

I tried things like calling .withCapabilities() but it is not working as i expected it and crashes the program.

In specific i want to set the 'acceptSslCerts' capability to true because it is false in default.

Does anybody have an idea on how to this? I'm not able to find anything in the API reference or on the internet.

Sakshi Singla
  • 2,462
  • 1
  • 18
  • 34
OYPS
  • 81
  • 1
  • 2
  • 13

2 Answers2

1

This works fine for me, to set CORS in my chrome browser.

const { Builder, By, Key, until } = require('selenium-webdriver');

const capabilities = {
    'chromeOptions': {
        'args': ['--disable-web-security', '--user-date-dir']
    }
}
let driver = new Builder().withCapabilities(capabilities).forBrowser('chrome').build();
MonicaEgg
  • 61
  • 1
  • 2
0

For firefox, through FirefoxProfile, you can accept SSL certificate.

e.g FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setAcceptUntrustedCertificates(true)

For googlechrome, through DesiredCapability, you can set the browser property.

Community
  • 1
  • 1
Ashish
  • 51
  • 3