c# - 当我使用自定义配置文件时,Selenium C# Firefox 不会打开 URL
问题描述
我在 C# 中的 selenium webdriver 中有这个奇怪的错误,如果我不使用配置文件,它只会打开一个 URL。下面的这段代码不起作用。
FirefoxOptions options = new FirefoxOptions();
options.AddArguments("-profile", profilePath);
IWebDriver driver = new FirefoxDriver(options);
driver.Navigate().GoToUrl("https://example.com"); //Opens Firefox (with profile) but not URL, times out
同时此代码有效。
FirefoxOptions options = new FirefoxOptions();
IWebDriver driver = new FirefoxDriver(options);
driver.Navigate().GoToUrl("https://example.com"); //Opens Firefox and URL no problem.
我尝试使用 Firefox 的-url启动参数,然后它打开 URL,即使使用配置文件,但它超时并且没有完成其余代码。
解决方案
推荐阅读
- javascript - 如何在Typescript中使用定义为多种类型之一的变量来对抗其中一种类型的数组?
- flutter - 如何在 Flutter 中构建具有自动宽度的布局
- python - 将 py3 解包翻译成 py2
- php - Laravel 任务调度
- r - 如何根据 R 数据框中的另一个变量创建具有 NA 或数字的数字变量
- amazon-s3 - S3 上的 ETL:重复行:如何更新旧条目?
- android - 在我的 gradle 中使用正确的材料设计库是什么,我尝试了不同的解决方案,它没有成功构建
- arrays - MATLAB:将字符数组输出格式化回声明的变量
- javascript - AngularJS - 如何根据解析器的结果中止 $stateProvider 构造?
- c++ - 在内部while循环中使用EOF时结束的while循环