Headless Browser Testing Using Chrome in Selenium - Mac

Published: 20 June 2017
on channel: Krishna Sakinala (Automation Testing)
3,397
13

Please use the following link to install the Katalon Studio:

https://katalon.com/sign-up?getr=kris... Check Tubebuddy Features Here:
https://www.tubebuddy.com/krishnasaki... A headless browser is a web browser without a graphical user interface. This program will behave just like a browser but will not show any GUI. Some of the examples of Headless Drivers include htmlunitdriver, phontomjs, nightmare, slimerjs, triflejs etc... Need to use Chrome options to achieve the headless in chrome for theat we need to add two arguments called "headless" and "window-size".

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class HeadlessTestWithChrome {

public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "/KRISHNA VOLUME/drivers/chromedriver");

ChromeOptions options = new ChromeOptions();
options.addArguments("window-size=1400,800");
options.addArguments("headless");

WebDriver driver = new ChromeDriver(options);
driver.get("http://automationtesting.in");
System.out.println("Site Title is: "+ driver.getTitle());
driver.findElement(By.cssSelector("#s")).sendKeys("testng");
driver.findElement(By.cssSelector("#s")).sendKeys(Keys.ENTER);
System.out.println("Site Title is: "+ driver.getTitle());
driver.quit();
}
}


On this page of the site you can watch the video online Headless Browser Testing Using Chrome in Selenium - Mac with a duration of hours minute second in good quality, which was uploaded by the user Krishna Sakinala (Automation Testing) 20 June 2017, share the link with friends and acquaintances, this video has already been watched 3,397 times on youtube and it was liked by 13 viewers. Enjoy your viewing!