How to use a already opened firefox for testing in Selenium

前端 未结 6 780
不思量自难忘°
不思量自难忘° 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:27

    In Java, when you say new a new object is instantiated. For WebDriver, every new is a new browser window.

    If you want the same browser to be used then use the same driver object.

    driver.get("URL PATH");
    

    This will go to the new Url with the already open browser.

提交回复
热议问题