Selenium Java to demonstrate the use of ChromeOptions class
KW.java
importorg.openqa.selenium.WebDriver;importorg.openqa.selenium.chrome.ChromeDriver;importorg.openqa.selenium.chrome.ChromeOptions;classKW{publicstaticvoidmain(String[]args){System.setProperty("webdriver.chrome.driver","/home/kodingwindow/drivers/chromedriver");ChromeOptionsco=newChromeOptions();// This argument used to open Chrome in maximized modeco.addArguments("--start-maximized");// This argument used to open Chrome in an incognito modeco.addArguments("--incognito");// This line used to disable pop-upsco.addArguments("--disable-popup-blocking");// This two lines prevents Chrome from displaying the notification 'Chrome is being controlled by automated software'co.setExperimentalOption("useAutomationExtension",false);co.setExperimentalOption("excludeSwitches",newString[]{"enable-automation"});// This argument used to set the size of Chrome browser windowco.addArguments("window-size=700,700");WebDriverdriver=newChromeDriver(co);driver.get("https://kodingwindow.com/testapp/");driver.close();}}
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.