首页 > 解决方案 > 在 Jenkins 上使用现有 Firefox 配置文件的问题

问题描述

我在 Jenkins 服务器中使用现有的 Firefox 配置文件时遇到问题。在本地,一切正常。我正在使用以下代码块来使用 Firefox 配置文件:

System.setProperty("webdriver.gecko.driver", "C:\\path\\to\\geckodriver.exe");
ProfilesIni profile = new ProfilesIni();
FirefoxProfile testprofile = profile.getProfile("selenium-profile");
FirefoxOptions opt = new FirefoxOptions();
opt.setProfile(testprofile);
WebDriver driver =  new FirefoxDriver(opt);
driver.get("https://www.google.com");

詹金斯上显示的错误:

org.openqa.selenium.WebDriverException: Unexpected value for profile: null

标签: javaseleniumselenium-webdriverautomationfirefox-profile

解决方案


推荐阅读