如何在 firefox 中传递 jsconsole 参数以启动浏览器控制台?
How to pass jsconsole argument in firefox to launch browser console?
I would like to open **Browser Console** for my session every time I launch Firefox.
Browser : Firefox v 61
How can you launch Browser Console for firefox:
1. open firefox (and give any URL )
2. Press Ctrl+Shift+J (or Cmd+Shift+J on a Mac)
Link : https://developer.mozilla.org/en-US/docs/Tools/Browser_Console
else if (browser.Equals(Constant.Firefox))
{
var profileManager = new FirefoxProfileManager();
FirefoxProfile profile = profileManager.GetProfile("ConsoleLogs");
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(DrivePath);
service.FirefoxBinaryPath = DrivePath;
profile.SetPreference("security.sandbox.content.level", 5);
profile.SetPreference("dom.webnotifications.enabled", false);
profile.AcceptUntrustedCertificates = true;
FirefoxOptions options = new FirefoxOptions();
options.AcceptInsecureCertificates = true;
options.Profile = profile;
options.SetPreference("browser.popups.showPopupBlocker", false);
driver = new FirefoxDriver(service.FirefoxBinaryPath, options, TimeSpan.FromSeconds(100));
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
}
我试图创建一个 bat 文件并将其提供给我的代码,但是这个批处理文件
创建一个新的 - 单独的 Firefox 浏览器会话,这不是我想要的,我想为当前会话启动 浏览器控制台 以实现我的自动化。
cd C:\Program Files\Mozilla Firefox
firefox -jsconsole
pause
代码:
Process p = new Process();
p.StartInfo.FileName = @"C:\Users\Com\Desktop\batch\FirefoxConsole.bat";
p.Start();
Thread.Sleep(2000);
我现在正在寻找什么:
如果可以的话,我想在我的 Selenium Firefox 配置文件中传递“-jsconsole”。
C:\Program Files\Mozilla Firefox>firefox.exe -jsconsole
而且我不知道该怎么做。
we just need to add this line in code where we initialing Firefox
options.AddArgument("--jsconsole");
else if (browser.Equals(Constant.Firefox))
{
var profileManager = new FirefoxProfileManager();
FirefoxProfile profile = profileManager.GetProfile("ConsoleLogs");
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(DrivePath);
service.FirefoxBinaryPath = DrivePath;
profile.SetPreference("security.sandbox.content.level", 5);
profile.SetPreference("dom.webnotifications.enabled", false);
profile.AcceptUntrustedCertificates = true;
FirefoxOptions options = new FirefoxOptions();
**options.AddArgument("--jsconsole");**
options.AcceptInsecureCertificates = true;
options.Profile = profile;
options.SetPreference("browser.popups.showPopupBlocker", false);
driver = new FirefoxDriver(service.FirefoxBinaryPath, options, TimeSpan.FromSeconds(100));
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
}
I would like to open **Browser Console** for my session every time I launch Firefox.
Browser : Firefox v 61
How can you launch Browser Console for firefox:
1. open firefox (and give any URL )
2. Press Ctrl+Shift+J (or Cmd+Shift+J on a Mac)
Link : https://developer.mozilla.org/en-US/docs/Tools/Browser_Console
else if (browser.Equals(Constant.Firefox))
{
var profileManager = new FirefoxProfileManager();
FirefoxProfile profile = profileManager.GetProfile("ConsoleLogs");
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(DrivePath);
service.FirefoxBinaryPath = DrivePath;
profile.SetPreference("security.sandbox.content.level", 5);
profile.SetPreference("dom.webnotifications.enabled", false);
profile.AcceptUntrustedCertificates = true;
FirefoxOptions options = new FirefoxOptions();
options.AcceptInsecureCertificates = true;
options.Profile = profile;
options.SetPreference("browser.popups.showPopupBlocker", false);
driver = new FirefoxDriver(service.FirefoxBinaryPath, options, TimeSpan.FromSeconds(100));
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
}
我试图创建一个 bat 文件并将其提供给我的代码,但是这个批处理文件 创建一个新的 - 单独的 Firefox 浏览器会话,这不是我想要的,我想为当前会话启动 浏览器控制台 以实现我的自动化。
cd C:\Program Files\Mozilla Firefox
firefox -jsconsole
pause
代码:
Process p = new Process();
p.StartInfo.FileName = @"C:\Users\Com\Desktop\batch\FirefoxConsole.bat";
p.Start();
Thread.Sleep(2000);
我现在正在寻找什么: 如果可以的话,我想在我的 Selenium Firefox 配置文件中传递“-jsconsole”。
C:\Program Files\Mozilla Firefox>firefox.exe -jsconsole
而且我不知道该怎么做。
we just need to add this line in code where we initialing Firefox
options.AddArgument("--jsconsole");
else if (browser.Equals(Constant.Firefox))
{
var profileManager = new FirefoxProfileManager();
FirefoxProfile profile = profileManager.GetProfile("ConsoleLogs");
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(DrivePath);
service.FirefoxBinaryPath = DrivePath;
profile.SetPreference("security.sandbox.content.level", 5);
profile.SetPreference("dom.webnotifications.enabled", false);
profile.AcceptUntrustedCertificates = true;
FirefoxOptions options = new FirefoxOptions();
**options.AddArgument("--jsconsole");**
options.AcceptInsecureCertificates = true;
options.Profile = profile;
options.SetPreference("browser.popups.showPopupBlocker", false);
driver = new FirefoxDriver(service.FirefoxBinaryPath, options, TimeSpan.FromSeconds(100));
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
}