Chrome extensions that can access/modify cookies while document.readyState is still in “loading”?

I built an extension that can intercept and append browser tab ID to all cookie names. By doing this, the real cookies stored into chrome will have the tab associated with the particular cookie.

This makes it so my test web application can have multiple tabs open within the same profile and each tab can have a separate session.

It all works very nicely, but not when the cookies are accessed from the dom “cookies” object when the document.readyState is in loading state.

It works just fine when cookies are set via the server, or when cookies are accessed after doucment.readyState = complete“.

I am trying to find any solution to make the extension able to intercept cookies that are accessed during document.readyState is in loading

Can it be done? Any insights on how one would accomplish this?

I can make changes to the Chromium C++ code to support this if that helps.

network request showing api call data Security

I have a WEB Api call (GetCustomers) which get a list of customers and that works fine.
Problem is in the Network Request after I have logged in I can see GetCustomers and on clicking this I can see the complete list of customers.

Is there a way to hide these calls from being displayed?
See attached – don’t want the GetRulesValidation call and resulting data to be displayed in the Network Request Tab within Chrome.

I am using Angular4 on the Front End and a C# WEB API.


NetworkRequest in Chrome

C++: Error in parsing JSON string

I want to read json message from extension:

This is JSON string:


And this is my function for parse it:

UINT getStringValue(string JSON_STRING, string key, string *value)
    stringstream str(JSON_STRING);
    json input = json::parse(JSON_STRING);

    //json input;
    //str >> input;

    *value = "";

    if (!input[key].is_null())
        *value = input[key].get();
        return 1;

    return 0;

When parsing func:

Unhandled exception at 0x75E308C2 in CkeyAx.exe: Microsoft C++ exception: nlohmann::detail::parse_error at memory location 0x00D6E364. occurred

C++: Error in parsing JSON string from html page

I want to read json message from extension:

This is JSON string:


And this is my function for parse it:

UINT getStringValue(string JSON_STRING, string key, string *value)
    stringstream str(JSON_STRING);
    json input = json::parse(JSON_STRING);

    //json input;
    //str >> input;

    *value = "";

    if (!input[key].is_null())
        *value = input[key].get();
        return 1;

    return 0;

When parsing func:

Unhandled exception at 0x75E308C2 in CkeyAx.exe: Microsoft C++ exception: nlohmann::detail::parse_error at memory location 0x00D6E364. occurred

Reconciling Bank Transaction in Xero

There is no built-in ability to reconcile bank transactions through the Xero API, and despite a significant demand for such a feature, it would seem Xero have no intention of adding one:

However, I have seen a number of Apps / SaaS system claiming to be able to do it, and I have a system that badly needs that last part of the automation.

I have been considering using a Chrome plugin, or some kind of screen/cursor manipulation as a workaround, but thought I would start by asking if anyone has achieved this? Knows of a project that might help?

Thanks in advance

How to get all available devices listed in Chrome Developer tool -> Emulated Device programmatically?

I want to get the list of emulated devices available in Chrome. Is there any way to get the whole list programmatically?

Basically, I would like to run my test on several emulated mobile device and mobile device name will be passed via a config file. I would like to check whether that device is available in list of chrome emulated device.

Worst case, I can use directly the passed device name and handle the exception thrown But I would like to do a check before only.

Using Selenium ChromeDriver how to load saved extension settings?

I am using Selenium.WebDriver.ChomeDriver v2.38.0 with Chrome v66.0.3359.117 (official build).

To continue discussion I will provide example extension. For this post I will use Ghostery - Privacy Ad Blocker v8.1.2.

Using C# I load the extension crx file, like this: (skipping the step of how I create the crx)

var options = new ChromeOptions();
options.AddExtension(workFolder + @"Chrome32extensions8.1.2_0.crx");
var driver = new ChromeDriver(options);

Which works great: Ghostery loads to it’s default settings. Which unfortunately are with all blockers disabled.

Switching back to my desktop and opening Chrome manually – I see that it did load my saved settings (everything blocked with Ghostery). Which tells me that somehow I need to load the saved settings programmatically. I’m fairly certain that during my manual browsing Chrome was able to do this because it loaded my Chrome user profile from C:UsersUSERNAMEAppDataLocalGoogleChromeUser DataDefault

I already know that I can directly load this user profile using

options.AddArgument("user-data-dir=" + @"C:UsersUSERNAMEAppDataLocalGoogleChromeUser DataDefault");

But I do not want to use that profile. It is 70MB large, and has lots of other goodies associated with it that I don’t want to use.

Instead, I want to programmatically load the saved extension settings, or, somehow save them in a place that will get loaded for me. Snooping around, I see that there is a Extension State folder in the user profile:

enter image description here

My hunch is that there must be a way to load these extensions settings in the Selenium way?

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

    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:!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?

Chromium is still opened after process exit

I use C# to call a puppeteer process, sometimes there is a blocking, so for avoiding this problem I set a time out to kill process.

But chromium is still opened after process exit. Right now I add chromeProcess.Kill() to make sure chromium is closed. What’s more, Chromium has a Processes Name Chrome, I must GetProcessesByName("chrome") to close puppeteer

Is there any better ways ?

 Process p = new Process();

 p.StartInfo.UseShellExecute = false;
 p.StartInfo.ErrorDialog = false;
 p.StartInfo.RedirectStandardOutput = true;
 p.StartInfo.RedirectStandardError = true;
 p.StartInfo.RedirectStandardInput = true;
 p.StartInfo.WorkingDirectory = ConfigurationManager.AppSettings["Location"];
 p.StartInfo.FileName = ConfigurationManager.AppSettings["NodeLocation"] + "node.exe";
 p.StartInfo.Arguments = @argument;


 //set timeout
 Console.WriteLine("Process time out");


//force Chromium to close
    Process[] chrome = Process.GetProcessesByName("chrome");
    foreach (Process chromeProcess in chrome)