I am trying to pass in ChromeOptions to my driver to allow for popups. I am using TestNG with the @BeforeClass, @Test, and @AfterClass annotations.. I am trying to enable pop ups and I have been succesful in doing so using the following method.
@BeforeClass
public void setUp(){
if (driver instanceof ChromeDriver){
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-popup-blocking");
driver = new ChromeDriver(options);
}
}
While this does work, it opens up the webdriver, then opens up another with the options. I do not want two webdrivers to pop up.. I just want to pass these options to the first webdriver! I am running these using an xml and a TestExtension class where the drivers get instantiated and do not want to alter that class. Is there a way to change the driver = new ChromeDriver(options) to something that will just pass these options in? Thanks!