[英]Setting specific capabilities for selenium webdriver
我正在嘗試為Selenium Webdriver設置一些特定功能。
在此示例中,我想更改Firefox瀏覽器capability of the webdriver
。 我正在使用Javascript嘗試此操作。
this.driver = new selenium.Builder().forBrowser('firefox').build();
我嘗試了諸如調用.withCapabilities()
類的事情,但是它沒有按我預期的那樣工作並使程序崩潰。
具體來說,我想將“ acceptSslCerts ”功能設置為true,因為默認情況下它為false。
有人對此有想法嗎? 我無法在API參考或互聯網上找到任何內容。
對於Firefox,可以通過FirefoxProfile接受SSL證書。
例如FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setAcceptUntrustedCertificates(真)
對於googlechrome,可以通過DesiredCapability設置瀏覽器屬性。
在我的chrome瀏覽器中設置CORS對我來說效果很好。
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();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.