I have create testcases in eclipse.but while runnig testng.xml file it's open in new browser every time.how to run it in single browser.i am calling below for every testcases so it's open in new browser.

    public static void setup()

        System.setProperty("webdriver.chrome.driver", "E:\\Selenium Jar\\chromedriver.exe");
        ChromeOptions options = new ChromeOptions();
        driver = new ChromeDriver(options);


Define the webdriver at the class level and then call the same webdriver instance on each and every test method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.