Selenium 2 Firefox Profile Change Location

 ̄綄美尐妖づ 提交于 2019-12-04 13:38:30

Look at FirefoxProfile:442

File profileDir = TemporaryFilesystem.getDefaultTmpFS()
          .createTempDir("anonymous", "webdriver-profile");
copyModel(model, profileDir);

The TemporaryFilesystem takes it's location from "java.io.tmpdir":, which usually points to system's temp directory. Santoshsarma's solution will work because of this line (but it will also move your OS temp directory).

private static File sysTemp = new File(System.getProperty("java.io.tmpdir"));

We can do more! Look at the public method setTemporaryDirectory!

You can invoke this method just before instantiating your FirefoxDriver and it should create it's profile copy at the location you specified.

Firefox uses the OS temp file location for storing temporary files

You need to change the location of the temp files in Windows in the control Panel if you want to use another location for temp files.

You can change the %TEMP% and %TMP% environment variables and make them point to a temp folder that you want to use.

Control Panel > System > Advanced > Environment variables

Refer : Firefox Support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!