Загрузка страницы

Execute Selenium Scripts in Headless Chrome - Windows

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", "Path to chromedriver.exe");

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();
}
}

Видео Execute Selenium Scripts in Headless Chrome - Windows канала Krishna Sakinala
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
27 июля 2017 г. 4:58:52
00:07:20
Яндекс.Метрика