How to use custom Firefox Profile with Selenium? (Java) (And pass HTML Authorization Window)

后端 未结 3 666
粉色の甜心
粉色の甜心 2020-12-19 09:52

How can I use Selenium with Java with a custom Firefox Profile?

3条回答
  •  半阙折子戏
    2020-12-19 10:22

    For Windows, to create a new Firefox Profile, type:

    firefox -profilemanager
    

    in Run that will open the Firefox Profile Manager.

    Let's say you have created a profile called Selenium, then you can use the following code:

    ProfilesIni listProfiles = new ProfilesIni();
    FirefoxProfile profile = listProfiles.getProfile("Selenium");
    WebDriver driver = new FirefoxDriver(profile);
    

提交回复
热议问题