How to use a already opened firefox for testing in Selenium

前端 未结 6 784
不思量自难忘°
不思量自难忘° 2020-12-05 15:49

This declaration

WebDriver driver = new FirefoxDriver();

always opens a new instance window of Firefox. It doesn\'t use the already opened

6条回答
  •  悲哀的现实
    2020-12-05 16:31

    Be careful with that, because in case the driver crashes once, then all the test cases that have to be executed after that will be affected because they are using the same driver, also you will be sharing cookies, and perhaps sessions already opened previously, etc.

    The more robust solution is to create a new WebDriver for each test cases because doing that you are making all your tests cases less dependent on the others.

    If the reason that is motivating you is the time each WebDriver takes to be created, perhaps you could start thinking on run test cases in parallel for example with TestNG.

    Thanks

提交回复
热议问题