如何在c# Selenium中向FirefoxDriverService添加配置文件规范?

How do you add a profile specification to a FirefoxDriverService in C# Selenium?

本文关键字:配置文件 添加 FirefoxDriverService 中向 Selenium      更新时间:2023-09-26

环境:Azure, c#, ClearScript, Selenium, Firefox

我正在将Selenium的Firefox符号暴露到ClearScript JavaScript环境中。在下面的JavaScript代码中,从c#中暴露/导出的符号都带有CS前缀。

// Preamble_LaunchBrowser.js
driverService = CSFirefoxDriverService.CreateDefaultService();
driverService.FirefoxBinaryPath = "C:''Program Files''Mozilla Firefox''firefox.exe";
driverService.HideCommandPromptWindow = true;
driverService.SuppressInitialDiagnosticInformation = true;
var options = new CSFirefoxOptions();
driver = new CSFirefoxDriver(driverService, options, CSTimeSpan.FromSeconds(10));
driver.Url = "http://www.google.com.au/";

目前我不支持配置文件,但想以某种方式添加它们。我如何在FirefoxDriverService的上下文中指定一个配置文件?

目前我不支持配置文件,但想以某种方式添加它们。我如何在FirefoxDriverService的上下文中指定一个配置文件?

如果我没有抓住重点,请原谅。

firefox.exe -p命令行启动FireFox,创建一个新的配置文件。

然后当你运行你的javascript,在FireFox中运行它在新创建的配置文件