Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Selenium Java中需要这些(Firefox)浏览器配置文件设置的chrome等价物_Java_Google Chrome_Selenium - Fatal编程技术网

在Selenium Java中需要这些(Firefox)浏览器配置文件设置的chrome等价物

在Selenium Java中需要这些(Firefox)浏览器配置文件设置的chrome等价物,java,google-chrome,selenium,Java,Google Chrome,Selenium,我一直在玩使用chrome浏览器的SeleniumJavaWebDriver,到目前为止已经取得了相当大的成功。我已经能够启动chrome窗口并发送和接收数据。我现在需要为Firefox浏览器找出与以下配置文件设置相同的chrome浏览器 FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.folderList", 2); profile.setPreference("bro

我一直在玩使用chrome浏览器的SeleniumJavaWebDriver,到目前为止已经取得了相当大的成功。我已经能够启动chrome窗口并发送和接收数据。我现在需要为Firefox浏览器找出与以下配置文件设置相同的chrome浏览器

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "image/jpg");
profile.setPreference("browser.download.dir", "path/to/downloads/pics/folder");
计划这样做(参考:),但需要如上所述设置其他属性

ChromeOptions chromeOptions = new ChromeOptions();
//set the rest of the preferences for chrome as shown above for Firefox
  • 硒:2.47.1
  • Mac:OsX约塞米蒂
  • 色度驱动器:2.18
  • JDK:1.8x
谢谢。

试试这个:

    ChromeOptions options = new ChromeOptions();  
    options.addArguments("--browser.download.folderList=2");
    options.addArguments("--browser.helperApps.neverAsk.saveToDisk=image/jpg");
    options.addArguments("--browser.download.dir=path/to/downloads/pics/folder");
    driver = new ChromeDriver(options);

复制品?谢谢Shubhasmit,我很快就会试试这个。接受答案。你能在引用这些选项的文档中添加一个链接吗?