使用selenium java在firefox gecko驱动程序中自动下载pdf
任何人都可以帮助创建配置文件并使用firefox( gecko 驱动程序 )设置选项,以自动下载selenium webdriver – java中的文件。 我已经搜索了很多谷歌搜索的选项,没有什么工作。 所以在堆栈溢出时发布我的查询。 如果可能,请帮助一些代码段。 这适用于selenium 3和firefox 52。
提前致谢。
1 /在firefox.exe -p中手动创建一个新的firefox配置文件
2 /使用这个新的配置文件运行firefox并设置为自动下载PDF文件
3 /使用这个:
@BeforeClass public static void setUpClass() { FirefoxOptions options = new FirefoxOptions(); ProfilesIni allProfiles = new ProfilesIni(); FirefoxProfile selenium_profile = allProfiles.getProfile("NAME OF THE NEW FIREFOX PROFILE"); options.setProfile(selenium_profile); options.setBinary("PATH TO FIREFOX.EXE"); System.setProperty("webdriver.gecko.driver", "PATH TO GECKODRIVER.EXE"); driver = new FirefoxDriver(options); driver.manage().window().maximize(); }
使用现有的自定义firefox配置文件,您可以使用几乎任何firefox设置修改(代理设置,1个导入证书,无需询问,扩展等)运行测试
不再需要在代码中指定:
FirefoxProfile selenium_profile = new FirefoxProfile(); selenium_profile.setPreference...
- selenium能处理自动完成吗?
- SessionNotCreatedException:无法创建新服务:在Ubuntu上使用Selenium Grid的GeckoDriverService无法驱动Firefox
- Selenium 3.0 Firefx驱动程序因org.openqa.selenium.SessionNotCreatedException而失败:无法创建新的远程会话
- Firefox浏览器没有打开selenium webbrowser代码
- 像Firefox一样使用标题制作JPanel边框
- 编写一个firefox插件并从java应用程序访问它
- 在Hadoop的mapreduce框架中运行“Selenium Webdriver”,在地图步骤中冻结
- 如何让Firefox在Mac OSX上使用Selenium WebDriver
- 如何使用FirefoxProfile通过Firefox浏览器自动下载?