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

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 my 'own' (testing api-built functionality), each test should not be logging into my application to run.

I would prefer to do the following:

  • Connect my webdriver tests to my open Firefox browser (already loggedin)
  • Run my webdriver projects with the same browser.
  • I understand that Selenium usually assigns a session id to its browsers. However, the current Java implementation of Selenium 2.0 driver does not make use of session id (maybe it does but I don't know where to find it. )

    Can someone provide some direction on how to resolve my issue (existing browser and run multiple tests with Selenium 2.0 (java))? Any code provided would also be helpful. Thanks!


    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:

  • Make sure you run "firefox -profilemanager" to create your initial profile and save your login information.
  • 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.

    链接地址: http://www.djcxy.com/p/52322.html

    上一篇: Selenium IDE,Server,RC,2.0和WebDriver有什么区别?

    下一篇: 如何在同一浏览器上重新运行Selenium 2.0(webdriver)测试?