- Jan 06, 2023
- admin
- 0
What is Chrome Options Class?
The Chromeoptions Class is a concept in Selenium WebDriver for manipulating various properties of the Chrome driver. It helps you to perform various operations like opening Chrome in incognito mode, maximized mode, disable existing extensions, disable pop-ups, etc.
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Interactions;
using System.Drawing;
using System.Threading;
namespace Selenium_Demo.TestCases
{
public class clsChromeOptions
{
public IWebDriver dr;
[SetUp]
public void Setup()
{
Console.WriteLine("I am from setup method");
ChromeOptions options = new ChromeOptions();
options.AddArgument("start-maximized"); //Maximize the window when it starts
options.AddArgument("incognito"); //To open browser in Incognito mode
//options.AddArgument("headless"); //To run test case in headless mode
options.AddArgument("disable-extensions"); //disables existing extentions
options.AddArgument("disable-popup-blocking"); //disabled popups displayed from chrome browser
options.AddArgument("disable-infobars");//disables info bars
dr = new ChromeDriver(@"path of your chrome driver",options);
}
[Test]
public void VerifyOptions()
{
dr.Navigate().GoToUrl("http://google.com");
}
}
}
Below are the most commonly used pre-defined capability types.
Capability Name | Description |
---|---|
ACCEPT_SSL_CERTS | This property tells the browser to accept SSL Certificates by default |
PLATFORM_NAME | This property is used to set the operating system platform used to access the web site |
BROWSER_NAME | This property is used to set the browser name for a web driver instance |
VERSION | This property to used to set the browser version |