Headless & WebSecurity Capabilities on Browsers

SDET & Updates: WebDriver Code
String driverPath = “src\\test\\resources\\framework\\testautomation\\commons\\utilities\\driver\\chromedriver.exe”
System.setProperty(“webdriver.chrome.driver”, driverPath);
ChromeOptions chromeOptions = new ChromeOptions();
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
chromeOptions.addArguments(“ — disable-web-security”);
chromeOptions.addArguments(“ — allow-running-insecure-content”);
chromeOptions.setAcceptInsecureCerts(true);
chromeOptions.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.ACCEPT);
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
chromeOptions.setHeadless(true);
ChromeDriver driver = new ChromeDriver(capabilities);
//WebDriver driver = new ChromeDriver();
//driver= new ChromeDriver(new ChromeDriverService.Builder().usingPort(34533).build());
WebDriverWait wait=new WebDriverWait(driver, 17);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get(emplocationUrl);
String driverPath = “src\\test\\resources\\framework\\testautomation\\commons\\utilities\\driver\\geckodriver.exe”;
System.setProperty(“webdriver.chrome.driver”, driverPath);
FirefoxBinary firefoxBinary = new FirefoxBinary();
firefoxBinary.addCommandLineOptions(“ — headless”);
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setBinary(firefoxBinary);
FirefoxDriver driver = new FirefoxDriver(firefoxOptions);

WebSecurity Enable/Disable

String driverPath = “src\\test\\resources\\framework\\testautomation\\commons\\utilities\\driver\\chromedriver.exe”;
//System.setProperty(“webdriver.chrome.driver”, “C:\\ProgramData\\Eclipse\\workspace\\src\\test\\java\\resources\\chromedriver.exe”);
System.setProperty(“webdriver.chrome.driver”, driverPath);
ChromeOptions chromeOptions = new ChromeOptions();
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
chromeOptions.setAcceptInsecureCerts(true);
chromeOptions.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.ACCEPT);
chromeOptions.addArguments(“ — disable-web-security”);
chromeOptions.addArguments(“ — allow-running-insecure-content”);
chromeOptions.addArguments(“ — allow-insecure-localhost” );
chromeOptions.addArguments(“test-type”);
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
chromeOptions.setHeadless(true);
ChromeDriver driver = new ChromeDriver(capabilities);
//WebDriver driver = new ChromeDriver();
//driver= new ChromeDriver(new ChromeDriverService.Builder().usingPort(34533).build());
WebDriverWait wait=new WebDriverWait(driver, 17);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
//NO need to have the JWT below with the location url so it will not be redirected
driver.get(emplocationUrl);

--

--

--

A self-learner in the programming and automation industry. Keep yourself updated in this journey together ;)

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Creating BlackJack game with Python

Verbatim Identifier in C# —The @ Special Character

What Sets CPanel Hosting Different From The Rest?

Speed tips for Wordpress websites

Laravel 6 Multiple Image Upload Tutorial

Google breaks developers’ incomes and do little to fix it

Go: Inlining Strategy & Limitation

Starbucks Capstone Challenge

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sdet & Updates

Sdet & Updates

A self-learner in the programming and automation industry. Keep yourself updated in this journey together ;)

More from Medium

The debate over which front-end framework will reign supreme has been going on since the beginning…

‘Data Archeology’: a search for a signal in the noise

Convolution Layer with Numpy