I am trying to connect to profile, its successfully connect to custom firefox profile, but the problem after that is command FirefoxDriver driver = new FirefoxDriver(options); no more works, works only if i remove options then no custom profile.
the before last line returns error OpenQA.Selenium.WebDriverException: 'Process unexpectedly closed with status 0' or The HTTP request to the remote WebDriver timed out after 60 seconds, it only works if I remove options inside FirefoxDriver: FirefoxDriver driver = new FirefoxDriver(options);
Also, doing options.AddArgument("-profile" + "C:\Users\Chill\AppData\Roaming\Mozilla\Firefox\Profiles\5k2mdm2k.myprofile");
instead of spliting the 2 arguments does not launch firefox in the right profile.
Or even options.AddArgument("no-sandbox")
or options.AddArgument("-no-sandbox")
or options.AddArgument("--no-sandbox")
doesn't works, also --profile
instead of -profile
does not open the right profile also, here is my code anyway:
using System;
using OpenQA.Selenium; // nuget package name: Selenium.WebDriver
using OpenQA.Selenium.Firefox; // nuget package name: Selenium.WebDriver.GeckoDriver
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
FirefoxOptions options = new FirefoxOptions();
options.AddArgument("-profile");
options.AddArgument(@"C:\Users\Chill\AppData\Roaming\Mozilla\Firefox\Profiles\5k2mdm2k.myprofile"); /* type about:profiles in firefox bar to create and manage firefox profiles, from there you will see which profile used, make sure to not use the default one and use root directory */
FirefoxDriver driver = new FirefoxDriver(options); /* code stops here and puts error after closing browser or waiting until it close itself after 60 sec */
driver.Navigate().GoToUrl("https://www.google.com/"); /* can only reach this part of code if i remove turn FirefoxDriver(options); to FirefoxDriver(); on the line upper, but no more custom profile so */
}
}
}
Hope you can help im blocked on this step for 3 days