How do I rerun Selenium 2.0 (webdriver) tests on the same browser?

后端 未结 1 607
梦毁少年i
梦毁少年i 2021-01-16 06:35

I am trying to use Selenium 2.0 (Webdriver) to implement a series of tests. Before these tests can run, I have to login into the application. Since the application is not

1条回答
  •  野的像风
    2021-01-16 07:36

    Here is what I have learnt:

    Selenium 1: As Ioan suggested earlier, use "-firefoxProfileTemplate" when starting up the Selenium RC server and point to the location of your Firefox profile.

    Selenium 2: I suppose you can use the Selenium 1 RC server, however, since Selenium 2 uses WebDriver, you can point to the profile information within your code.

    File profileDir = new File("/Users/_____/selenium/FFprofile");
    FirefoxProfile profile =
    new FirefoxProfile(profileDir);
    WebDriver driver = new FirefoxDriver(
        profile);
    

    Notes:

    1. Make sure you run "firefox -profilemanager" to create your initial profile and save your login information.
    2. Allow the browser/website to always store your authentication credentials avoiding "popup"/"login" wwindows, etcs.

    Hope this helps somebody who may run into a similar issue: Using the same browser profile in Selenium, etc.

    0 讨论(0)
提交回复
热议问题