我为webDriver创建了Firefox。
下面是创建的概要文件的代码:
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myProfile = profile.getProfile("Selenium");
driver = new FirefoxDriver(myProfile);其中"Selenium“是配置文件的名称。它在我的机器上运行得很好。现在,我想把这个项目部署到其他人身上。但他并没有将firefox配置文件中的首选项设置为与我的相同。所以他不能用剧本。
如何在我的框架/项目中添加这个firefox配置文件,所以如果我将相同的框架提供给其他人,他可以使用相同的功能。
发布于 2014-07-15 13:39:00
您需要从Mozilla备份您的配置文件,如本教程所述。而不是将该配置文件作为项目的一部分(因此将其放到src/test/resources中的某个地方),然后只需执行
File profileDir = new File(profileLocation);
FirefoxProfile profile = new FirefoxProfile(profileDir);
WebDriver driver = new FirefoxDriver(profile);或者,您也可以在Java代码中创建自己的代码,这取决于配置文件有多少设置。
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("general.useragent.override", "some UA string");
WebDriver driver = new FirefoxDriver(profile);https://stackoverflow.com/questions/24759657
复制相似问题