I tried to implement Chrome Options
in my script to delete that yellow information bar from Chrome, which is displayed every time we run automated tests (" Chrome is being controlled by automated test software " ), but the result I had was the display of two windows of Chrome: one minimized, displaying the infobar, and another maximized without the display of the infobar, where my script was executed.
Please, could you guide me where I'm going wrong? I have made several modifications but I have not been able to correct this double opening of the browser:
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace navegador.PageObjects
{
public class acessaSite
{
public IWebDriver driver;
public acessaSite(IWebDriver driver)
{
this.driver = driver;
}
public void acessaURL()
{
var options = new ChromeOptions();
options.AddArguments("--disable-infobars");
options.AddUserProfilePreference("credentials_enable_service", false);
options.AddUserProfilePreference("profile.password_manager_enabled", false);
driver = new ChromeDriver(options);
driver.Manage().Window.Maximize();
driver.Navigate().GoToUrl("https://meusite.com.br");
Thread.Sleep(1000);
}
}
}
Thank you!