java - Selenium Firefox 加载配置文件,但 Web 驱动程序部分不再工作
问题描述
FirefoxOptions options3 = new FirefoxOptions();
options3.setHeadless(false);
options3.addArguments("profile","C:\\Users\\Administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\i8k6kx4s.default");
WebDriver driver3 = new FirefoxDriver(options3);false);
Thread.sleep(1000);
driver3.get("https://ramdonwebsit.com");
它会打开个人资料,但不会访问网站。我正在尝试加载已在其中保存缓存数据和密码的特定配置文件,因此我可以直接访问该网站并避免出现带有验证码的登录问题。
解决方案
试试下面 -
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("Your_Profile");
WebDriver driver = new FirefoxDriver(myprofile);
Thread.sleep(1000);
driver.get("https://ramdonwebsit.com");
推荐阅读
- python - Django OAuth 工具包 - 仅管理员用户问题
- django - 如何在 Django 表中显示用户 ID
- python - pygame的屏幕会根据不同的显示器调整吗?
- c++ - (i)+ (++i) {for i=1} 如何变成 4 而不是 3?
- java - Spring-Boost 应用程序和 Apache Ignite 配置:启动 ApplicationContext 时出现问题
- excel - 将 Excel 附加语句写入哈希函数?
- python - 在堆积条形图 pandas 中显示值
- python - 神经网络 - 训练和验证错误曲线?
- swift - NavigationView 栏材料在 iOS 15 上不可见
- django - 将视图 API 转换为 celery 任务的标准方法