How to use MasterDevs ChromeDevTools in .NET?

MasterDevs ChromeDevTools is a .NET Library to interact with the Chrome Developer Tools, I discovered it yesterday while searching for the efficient and simplest way to make use of the chrome websockets protocol, and I was trying to manage how can I compile a custom javascript script in the console window, but I didn’t found the way to do this, because the library is giant, and the XML documentation for each member is very, very, very poor, so you can’t understand the purpose of any member, and the author only provides one tiny usage example of how to use two specific commands of the thousands of commads inside the lib. So I don’t get the idea how to use this library to interact with the console, to input a script in the console window, and compile it.

So I’m blind with this library, and also the official google documentation for Runtime, Debugger or Console does not help me to find the way to compile a script in the console window…

I just want to automate the insertion of a js script in the console window, and execute it, like this:

enter image description here

I tried to use the Chrome.Runtime.EnableCommand class, then a Chrome.Runtime.CompileScriptCommand, but nothing happens when I try to get the resulting CommandResponse object (which I never get) when calling and awaiting the IChromeSession.SendAsync() function.

I also tried the same but using Chrome.Debugger.EnableCommand class and Chrome.Debugger.SetScriptSourceCommand, just trying for try experimenting things, because I don’t know what member I should use in this library.

Well, to show what I tried with the library, in VB.NET, I just took the C# MasterDevs usage example from GitHub and tried to find the right command to compile a script:

Imports MasterDevs.ChromeDevTools
Imports MasterDevs.ChromeDevTools.Protocol

Task.Run(
    Async Sub()

        Dim chromeProcessFactory = New ChromeProcessFactory(New StubbornDirectoryCleaner())

        Using chromeProcess As IChromeProcess = chromeProcessFactory.Create(9222, True)

            Dim sessionInfo As ChromeSessionInfo = (chromeProcess.GetSessionInfo().Result).LastOrDefault()
            Dim chromeSessionFactory = New ChromeSessionFactory()
            Dim chromeSession = chromeSessionFactory.Create(sessionInfo.WebSocketDebuggerUrl)

            Dim runtimeEnable As New Chrome.Runtime.EnableCommand
            Dim runtimeEnableResponse As CommandResponse(Of Chrome.Runtime.EnableCommandResponse) =
                Await chromeSession.SendAsync(runtimeEnable)

            Dim debuggerEnable As New Chrome.Debugger.EnableCommand
            Dim debuggerEnableResponse As CommandResponse(Of Chrome.Debugger.EnableCommandResponse) =
                Await chromeSession.SendAsync(debuggerEnable)

            Dim compileScript As New Chrome.Runtime.CompileScriptCommand
            compileScript.Expression = .Value
            Dim compileScriptResponse As CommandResponse(Of Chrome.Runtime.CompileScriptCommandResponse) =
                Await chromeSession.SendAsync(compileScript)

            Dim setScriptSource As New Chrome.Debugger.SetScriptSourceCommand()
            setScriptSource.ScriptSource = .Value

            Dim setScriptSourceResponse As CommandResponse(Of Chrome.Debugger.SetScriptSourceCommandResponse) =
                Await chromeSession.SendAsync(setScriptSource)

        End Using
    End Sub).Wait()

…note that my code is trash, because it does nothing of the expected things more than opening a new chome instance.

The reason why I’m using the Chrome.XXXXX.EnableCommand classes is because I found this question and its answer: https://groups.google.com/forum/#!topic/chrome-debugging-protocol/tmgIQrkr5zI and since the lack of XML documentation in MasterDevs lib, I think the Enablecommand classes are equivalents to what says in that answer from google groups, and because what the answer says, it seems required to use the EnableCommand class before nothing… but I’m really not sure whether Chrome.Runtime.Enablecommand class is a equivalent of Runtime.enable, neither whether I used it properly…

My question is:

how can I use the MasterDevs ChromeDevTools library in C# or VB.NET to insert a js code snippet in the Chrome’s console window and then execute it?.

Internet explorer extension development

I have a problem I am going to develop an Extension for internet explorer 9. But I am not able to understand how to start creating Extension for internet explorer. Using this extension I wanted to fill a form dynamically and the data come from a rest API. So, please suggest me how can I develop this extension step by step?Because I am new in explorer extension development?

ChromeDriver C# Disable developer extensions selenium

I’m trying to disable extensions when running selenium in my C# project. Using the example here, I was able to do so.

ChromeOptions options = new ChromeOptions();
options.AddArgument("--start-maximized");
options.AddArguments("--disable-extensions");
var drv = new ChromeDriver("MY_CHROME_DRIVER_PATH", options);

However, this doesn’t work with the latest version of Chrome v63 and the selenium webdriver v2.9. After doing some research, I found that the driver includes an automation extension which is still enabled, when the disable extensions argument is passed. The suggestion used below does not work with the .NET driver.

chromeOptions.setExperimentalOption("useAutomationExtension", false);

As I have a managed machine and I can’t enable the access to install Chrome extensions. How do I disable all extensions along with the automation extension in C#?

how to execute exe of windows/local machine via chrome extension? [on hold]

i saw one demo https://www.youtube.com/watch?v=H82-9hg1Plg
but cant understand what to do and host.js or background.js
if anyone have idea then please suggest me

thanks