简体   繁体   中英

Setting specific capabilities for selenium webdriver

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.

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

eg FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setAcceptUntrustedCertificates(true)

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

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM