Selenium with Java 55 - Working with Chrome & Firefox in headless mode | ChromeOptions FirefoxOpions

Published: 13 April 2020
on channel: Ankpro Training
878
11

What is ChromeOptions class?
What is FirefoxOptions class?
Test case execution using chrome in headless mode
Test case execution using Firefox in headless mode

What is ChromeOptions class?
Class to manage options specific to Chrome browser org.openqa.selenium.chrome.ChromeOptions

public void addArgument(string argument);
Adds a single argument to the list of arguments to be appended to the Chrome.exe command line.
Example :
ChromeOptions options = new ChromeOptions();             
options.addArgument("--headless");

What is FirefoxOptions class?

Class to manage options specific to firefox browser org.openqa.selenium.firefox.FirefoxOptions

public void addArgument(string argument);
Adds a single argument to the list of arguments to be appended to the Firefox.exe command line.
Example :
FirefoxOptions options = new FirefoxOptions();             
options.addArgument("--headless");

Possible Interview Questions on selenium chrome and firefox headless browsing
What is a ChromeOptions class?
How to execute the test cases in Chrome Headless browser?
What is a FirefoxOptions class?
How to execute the test cases in Firefox Headless browser?

Code :
@Test
public void chromeAndfirefoxHeadless()
{
// ChromeOptions options=new ChromeOptions();
// options.addArguments("--headless");
FirefoxOptions options=new FirefoxOptions();
options.addArguments("--headless");


WebDriver driver=new FirefoxDriver(options);
driver.get("http://ankpro.com");
String s=driver.findElement(By.className("lead")).getText();
System.out.println(s);
driver.quit();
}


Watch video Selenium with Java 55 - Working with Chrome & Firefox in headless mode | ChromeOptions FirefoxOpions online without registration, duration hours minute second in high quality. This video was added by user Ankpro Training 13 April 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 87 once and liked it 1 people.