Why Selenium always create temporary Firefox Profiles using Web Driver?

最后都变了- 提交于 2019-12-06 14:55:43

The main reason that the Firefox driver uses a temporary profile is to support the use case of running multiple independent simultaneous instances of Firefox. At one time, when Firefox launched, it would drop a sentinel or lock file in the profile directory, and would detect that file if the user attempted to start a new instance of Firefox, preventing them from doing so. Whether or not Firefox still exhibits this behavior, the driver still has to work with some older versions of the browser, and has to account for it. The Selenium project's solution to that issue with WebDriver, when a user wants to use a specific profile, is to copy the contents of that profile to a new directory, and launch Firefox pointing to the copy.

It sounds like Mozilla's implementation does largely the same thing. I would guess it's for the same reason - to support the multiple-instance use case.

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