Hi. I tried upgrade my chromedriver to 101.0.4951.41 today and it sudden keep prompt this error to me. Anything I missed or what I should add for new version?
And this is my code:
options.AddArgument("start-maximized");
options.AddArgument("--disable-extensions");
options.AddArgument("--disable-blink-features");
options.AddArgument("--disable-blink-features=AutomationControlled");
options.AddArgument("--disable-gpu");
options.AddArgument("--no-sandbox");
options.AddArgument("--allow-running-insecure-content");
options.AddArgument("--ignore-certificate-errors");
options.AddArgument("--disable-background-networking");
options.AddExcludedArguments(new List<string>() { "enable-automation" });
options.AddUserProfilePreference("credentials_enable_service", false);
options.AddUserProfilePreference("password_manager_enabled", false);
ChromeDriverService chromeDriverService=ChromeDriverService.CreateDefaultService();
chromeDriverService.HideCommandPromptWindow = true;
IWebDriver Driver = new ChromeDriver(chromeDriverService, options);
IDevTools devTools = Driver as IDevTools;
IDevToolsSession session = devTools.GetDevToolsSession();
Fixed by adding the protocol version (i.e.)
using DevTools = OpenQA.Selenium.DevTools.V96;
:
:
IDevTools devTools = webDriver as IDevTools;
IDevToolsSession session = devTools.GetDevToolsSession(96);
Had a similar issue and it seems in versions above and equal 100 need to have the remote-debugging-port argument set.
Add this to args:
"--remote-debugging-port=9222"
This opens the devtools for me when I open the driver itself. I tested it on version 101.0.4951.41 so it should work fine for you. (no remote debugging port required)
options.AddArgument("--auto-open-devtools-for-tabs");
Apparently the new version of chromedriver (101.0.4951.41) is not compatible with old version of DevTools
I can solved this issue updated Selenium.WebDriver to 4.1.1 and used "OpenQA.Selenium.DevTools.V101.Network"
Related
When I create a firefox driver with a firefox driver service this is logged to the console: 1564067211938 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\minec\\AppData\\Local\\Temp\\rust_mozprofile.wCNOb94oHRE2" The problem is the console when this happens gets effectively separated from my program and doesn't close when I close it with the stop button in visual studio. I also can't log anything to the console after that.
Is there any way to disable it?
Here is my code:
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(geckoDriverPath.Replace(#"\geckodriver.exe", ""), "geckodriver.exe");
var driver = new FirefoxDriver(service);
I figured out how to remove all logs except fatal error logs.
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(geckoDriverPath.Replace(#"\geckodriver.exe", ""), "geckodriver.exe");
var options = new FirefoxOptions();
options.LogLevel = FirefoxDriverLogLevel.Fatal;
var driver = new FirefoxDriver(service, options);
Try adding System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "target" + File.separator + "browser.log");
before the browser is being initialized
ie. before
var driver = new FirefoxDriver(service);
I am using below mentioned code to initialize a firefox driver with service, options and timeout.
var Service = FirefoxDriverService.CreateDefaultService(RunConfig.DriverPath);
Service.HideCommandPromptWindow = RunConfig.HideDriverCommandPromptWindow;
var Options = new FirefoxOptions();
if (!string.IsNullOrWhiteSpace(RunConfig.PathToBrowserBinary))
Options.BrowserExecutableLocation = RunConfig.PathToBrowserBinary;
Options.Profile = new FirefoxProfile();
Options.Profile.SetPreference(Preference.Name,PathToDownloadFolder));
Options.Profile.SetPreference(Preference.Name, Preference.Value);
return new FirefoxDriver(Service, Options, TimeSpan.FromSeconds(90));
But it gives me an error that The path is not of legal for while initializing firefox profile
Solved it. The problem was the seleniumwebdriver dll I was using is present in some other project. Adding the selenium webdriver and support dll to the current project worked.
IDE: Visual Studio 2015
Geckodriver.exe (Version 0.19.0) - Published: 9/25/2017
Firefox version: 56.0b8 (64-bit)
Selenium webdriver version: 3.6.0
Using Selenium and C # I did as lines of code below:
using (FirefoxDriver = new FirefoxDriver () driver)
{
driver.Navigate (). GoToUrl("https://www.teste.gov.br/seguro/loginPortal.asp");
Thread.Sleep (1000 * 60);
}
The page opens a message of "Your connection is not private", error "Your connection is not secure".
To resolve this issue you have already used the following codes:
profile = webdriver.FirefoxProfile ()
profile.accept_untrusted_certs = True
driver = new FirefoxDriver (profile)
profile = webdriver.FirefoxProfile ()
profile.accept_untrusted_certs = True
driver = new FirefoxDriver (profile)
profile.setAcceptUntrustedCertificates (true);
profile.setAssumeUntrustedCertificateIssuer (false);
driver = new FirefoxDriver (profile)
ffProfile.setAcceptUntrustedCertificates (true)
ffProfile.setAssumeUntrustedCertificateIssuer (false)
driver = new FirefoxDriver (ffProfile)
and other codes ...
But the problem continues. How to solve this problem?
TL:DR; There is no reasonable approach to solving this problem.
If it's absolutely necessary to visit the site only, e.g. to create a cookie, use PhantomJS. Every browser driver I've tried gives the error, and it's impossible to bypass without some sort of security exploit.
The browser is literally letting you know the site is insecure. Albeit its a government site, it might be compromised.
On a separate note, its probably cleaner to do this:
FirefoxDriver() ffDriver = new FirefoxDriver();
ffDriver.Navigate("myCoolSite.url");
I've been searching for the correct documentation on how to use ChromeOptions and DesiredCapabilities in the atmosphere of Selenium and C#, but since it's all open sourced, I only find suggestions (and they are not helping sometimes). My question today is how to setup the correct relation between ChromeOptions and DesiredCapabilities. Seems like I'm doing everything correctly, but still getting System.InvalidOperationException: unknown error:cannot parse capability: chromeOptions from unknown error: unrecognized chrome option:Arguments My code is following:
private static ChromeOptions Ops()
{
var options = new ChromeOptions();
options.AddArgument("--no-startup-window");
options.BinaryLocation = #"C:\path\path\path\chromedriver.exe";
return options;
}
private static DesiredCapabilities Caps()
{
DesiredCapabilities caps = new DesiredCapabilities();
caps.SetCapability(CapabilityType.BrowserName, "chrome");
caps.SetCapability(ChromeOptions.Capability,Ops().ToCapabilities());
return caps;
}
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), Caps());
Can't find a place where incorrect Arguments are passing. Has anybody faced the same issues? This is ChromeDriver version 2.28 and selenium WebDriver v 3.3.0 Google Chrome browser version is 52.
You don't need to set the browser name; ChromeOptions does that for you.
According to this comment
The .NET bindings are moving toward a pattern where DesiredCapabilites should not be
used directly, even with RemoteWebDriver. To facilitate that, the ChromeOptions class
has a ToCapabilities() method
And there's this comment
Much like --disable-javascript, the chromedriver will not work if you use --no-startup-window.
It needs to launch a window to establish the connection with the AutomationProxy.
So that gets us to this:
var options = new ChromeOptions();
options.BinaryLocation = #"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), options.ToCapabilities());
However, are you actually running a grid? If you're testing on a single machine it's even simpler:
IWebDriver driver = new ChromeDriver();
How to provide OperaWebDriver on c# use Selenium WebDriver
IWebDriver aDriver = new OperaDriver("path_to_operadriver.exe);
I have exception :
System.InvalidOperationException : unknown error: cannot find Opera
binary (Driver info: OperaDriver=0.2.0 )
Using setBinary gives me an error. I am able to resolve it by using this:
options.BinaryLocation = #"/path/to/opera";
Similarly for chrome as well.
You've got to download opera chromium driver.
Here's a snippet how it should work:
DesiredCapabilities capabilities = DesiredCapabilities.opera();
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/opera");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);