I see that there's a relatively new option to open Chrome with Devtools open from the command line, which I have gotten to work from my Windows 8.1 command line using a call like this:
c:\Program Files (x86)\Google\Chrome\Application>"chrome.exe" --auto-open-devtools-for-tabs
When I try to add this option on the same box when creating my ChromeDriver
in Selenium (in C#), however, the option seems to be ignored.
var options = new ChromeOptions();
options.AddArgument("auto-open-devtools-for-tabs");
string executingAssembly = System.Reflection.Assembly.GetExecutingAssembly().Location;
string driverPath = Path.Combine(Path.GetDirectoryName(executingAssembly), "ChromeWebDriver");
_driver = new ChromeDriver(driverPath, options);
I've tried a few variations on theme to make sure options are working at all, including...
var options = new ChromeOptions();
options.AddArguments(new[] { "start-maximized", "auto-open-devtools-for-tabs"});
... and...
var options = new ChromeOptions();
options.AddArgument("start-maximized");
options.AddArgument("auto-open-devtools-for-tabs");
... and...
var options = new ChromeOptions();
options.AddArgument("start-maximized");
options.AddExcludedArgument("auto-open-devtools-for-tabs");
... as well as setting those with --
in front of each option string. All I get from any of those are maximized windows.
I get the feeling the auto-open-devtools-for-tabs
argument's not supported by Selenium's Chrome Web Driver, but I'm not sure why that wouldn't support the same set of options as the "full" app.
Anyone have this option working with Selenium in C#, or know why it shouldn't be working in this case?
This is not unlike this question, but here I'm asking specifically about the auto-open-devtools-for-tabs
option with C#. That asker claims not to have had any luck with options, and was asking how to open devtools from "within" Selenium, looking for a method explicitly before this option existed.
AddUserProfilePreference
. Worth a shot; thanks. But no devtools when I run it, same as before. And though it's a different route, I did trySendKeys
, but it only opened devtools intermittently. Worse, the times it does work, I get kinda what I thought I might,disconnected: received Inspector.detached event\n (Session info: chrome=50.0.2661.102) (Driver info: chromedriver=2.21.371459...
So no luck yet. – Mouthwatering