我正在尝试使用TypeScript在私有模式下启动Firefox。我已经尝试过了,它不会使用私有模式:
static async CreateFirefoxDriver():Promise<WebDriver>
{
//Create the firefox capabilities
var firefoxCapabilities = Capabilities.firefox();
//Use Private Window
var firefoxOptions = {
'args': ['-private']};
firefoxCapabilities.set('firefoxOptions', firefoxOptions);
var driver = await new Builder().withCapabilities(firefoxCapabilities).build();
//Maximize the window
await driver.manage().window().maximize();
return driver;
}
static async CreateFirefoxDriver():Promise<WebDriver>
{
var options = new firefox.Options();
options.addArguments("-private");
var driver = await new Builder().forBrowser("firefox").setFirefoxOptions(options).build();
//Maximize the window
await driver.manage().window().maximize();
return driver;
}