首页 > 解决方案 > 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");

它会打开个人资料,但不会访问网站。我正在尝试加载已在其中保存缓存数据和密码的特定配置文件,因此我可以直接访问该网站并避免出现带有验证码的登录问题。

标签: javaseleniumfirefox

解决方案


试试下面 -

ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("Your_Profile");
WebDriver driver = new FirefoxDriver(myprofile);
Thread.sleep(1000);
driver.get("https://ramdonwebsit.com");

推荐阅读