Monday, 16 October 2017

Code Example - Disable Invalid Extension in Chrome Browser

Exported from Notepad++
package com.practiceCode; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; /** * @Blog Name: Selenium Code Example * @author Deepak Gupta * @Created Date 17-10-2017 * */ public class DisableInvalidExtensionInChromeBrowser { WebDriver driver; @BeforeTest public void setUp() { try { System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") +
"/drivers/chromedriver.exe"); // Handle - disable the invalid Extension ChromeOptions options = new ChromeOptions(); options.addArguments("disable-infobars"); driver = new ChromeDriver(options); } catch (Exception e) { e.printStackTrace(); } } @Test public void testDisableInvalidExtensionInChromeBrowser() { driver.get("https://www.google.co.in"); } @AfterTest public void tearDown() throws InterruptedException { driver.quit(); } }

No comments:

Post a Comment

Code Example - File Download By Robot Class In Firefox Browser

Exported from Notepad++ package com . practiceCode ; import java . awt . AWTException ; import java . awt . Robot ; import j...