package com.practiceCode;
import java.util.HashMap;
import java.util.Map;
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 DisableSavePasswordExtensionInChromeBrowser {
WebDriver driver;
@BeforeTest
public void setUp() {
try {
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") +
"/drivers/chromedriver.exe"); // Handle - disable the save password Extension ChromeOptions options = new ChromeOptions(); Map<String, Object> prefs = new HashMap<String, Object>(); prefs.put("credentials_enable_service", false); prefs.put("profile.password_manager_enabled", false); options.setExperimentalOption("prefs", prefs); driver = new ChromeDriver(options); } catch (Exception e) { e.printStackTrace(); } } @Test public void testDisableSavePasswordExtensionInChromeBrowser() { driver.get("https://www.google.co.in"); } @AfterTest public void tearDown() throws InterruptedException { driver.quit(); } }
"/drivers/chromedriver.exe"); // Handle - disable the save password Extension ChromeOptions options = new ChromeOptions(); Map<String, Object> prefs = new HashMap<String, Object>(); prefs.put("credentials_enable_service", false); prefs.put("profile.password_manager_enabled", false); options.setExperimentalOption("prefs", prefs); driver = new ChromeDriver(options); } catch (Exception e) { e.printStackTrace(); } } @Test public void testDisableSavePasswordExtensionInChromeBrowser() { driver.get("https://www.google.co.in"); } @AfterTest public void tearDown() throws InterruptedException { driver.quit(); } }
No comments:
Post a Comment