Browser Options in Selenium



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 NameDescription
ACCEPT_SSL_CERTSThis property tells the browser to accept SSL Certificates by default
PLATFORM_NAMEThis property is used to set the operating system platform used to access the web site
BROWSER_NAMEThis property is used to set the browser name for a web driver instance
VERSIONThis property to used to set the browser version
Tags: ,
Leave a comment

Your email address will not be published. Required fields are marked *

Subscribe now

Receive weekly newsletter with educational materials, new courses, most popular posts, popular books and much more!

https://bridgejunks.com/ https://crownmakesense.com/ https://brithaniabookjudges.com/ https://hughesroyality.com/ https://rhythmholic.com/ https://bandar89.simnasfikpunhas.com/ https://www.100calshop.co.il/products/thailand/ https://myasociados.com/ https://solyser.com/ http://konfidence.cz/ https://muscadinepdx.com/ https://bandar89.parajesandinos.com.ve/ https://goremekoop.com/ https://oncoswisscenter.com/ https://www.turunclifehotel.com/bandar89/ https://www.houseofproducts.biz/ https://taimoormphotography.com/
BIJI18 BIJI18 BIJI18