4

Context: Azure, C#, ClearScript, Selenium, Firefox

I'm exposing Selenium's Firefox symbols into a ClearScript JavaScript environment. In the following JavaScript code, the symbols exposed/exported from C# are prefixed with CS.

// Preamble_LaunchBrowser.js
driverService = CSFirefoxDriverService.CreateDefaultService();
driverService.FirefoxBinaryPath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
driverService.HideCommandPromptWindow = true;
driverService.SuppressInitialDiagnosticInformation = true;
var options = new CSFirefoxOptions();
driver = new CSFirefoxDriver(driverService, options, CSTimeSpan.FromSeconds(10));
driver.Url = "http://www.google.com.au/";

At present I have no support for profiles, but would like to add them somehow. How would I specify a profile in the context of a FirefoxDriverService?

bugmagnet
  • 7,631
  • 8
  • 69
  • 131

1 Answers1

1

At present I have no support for profiles, but would like to add them somehow. How would I specify a profile in the context of a FirefoxDriverService?

Forgive me if I'm missing the point.

Just start up FireFox with this command line firefox.exe -p to create a new profile.

Then when you run your javascript, run it in FireFox under the newly created profile.

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
  • That works on the command line. However I'm talking to firefox via Selenium. I can't see `driverService.FirefoxBinaryPath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe -p profilename";` working. – bugmagnet Oct 27 '16 at 01:34
  • Yeah I don't see it working creating a FF profile via Selenium hence my suggestion create the profiles and run your code under the user profile – Jeremy Thompson Oct 27 '16 at 05:39
  • Did you try it though? creating a profile and starting it with the `-p profilename`? – Jeremy Thompson Nov 02 '16 at 00:24