我想使用 C# selenium webdriver 创建并保存一个 firefox 配置文件。并使用 selenium web 驱动程序中的现有配置文件。
1 回答
0
您应该首先创建一个 Firefox 配置文件,然后将其嵌入到 selenium 代码中。您可以使用默认配置文件,但由于以前的现金和不必要的插件,您可能会在第一次运行时遇到“Java Heap”错误。所以第一步是:
1. 创建新的 Firefox 配置文件:
1.1。按住 Windows 键并按键盘上的 R 并写入firefox.exe -p
1.2. 单击打开的窗口上的创建配置文件按钮并使用向导创建一个新的配置文件(在我的情况下,我创建了 MyCreatedProfile)
你的代码
var profileManager = new FirefoxProfileManager();
FirefoxProfile profile = profileManager.GetProfile("MyCreatedProfile");
IWebDriver driver = new FirefoxDriver(profile);
于 2021-09-18T06:09:07.707 回答
