Chrome: JSON (or other object) into chrome_debug.log - google-chrome

when I use chrome.exe with --enable-logging parameter it enables chrome to log console messages into debug file.
Sadly it missing the object details:
Example:
[1208:1164:1028/12048.086:INFO:CONSOLE(1)] "%c[WS Message] something color: #7c7c7c", source:something.js (1)
The (1) Stands for the JSON object inside I want to explore in real time in Python. Anyone have idea how to make chrome to save object as string for example in chrome_debug.log?? (Extension or some console command?)
Or any other solution that would enable to view the object in realtime in python?
(Yes i know you can right click on in actual chrome console by mouse then use "copy object", So yes, technicaly, i can make a macro which would do it in real time, but that woud be completely crazy.

I solved this by making Chome extension in Java, that copy-paste JSON objects from dev console. Little bit workaround, but better working that Selenium.

Related

View JSON in Chrome Network response

I think I lost a feature or a configuration.
When you open inspector and inspect network requests, I used to see a formatted JSON tree when a Network request is returning a JSON string.
Now I had to add the console custom formatter and copy paste the JSON response in the console... pretty time consumer.
Do you think Chrome lost a feature or am I just dreaming ?
I saw several older chrome' versions with the Json format feature, but as you said, on the newest... some versions of jsons (it might be related with the content type or format) is shown as a plain text.
We've been using dbug.io since they beta released and it helps us deal with several jsons files.
Hope this helps!

pywinauto: accessing chrome gui

I am trying to select a printer and print on chrome browser, using pywinauto, but I am not able to access the gui components. I can see the components in Microsoft Inspect.exe in UIAutomation mode. (See screenshot).
I have started chrome with --force-renderer-accessibility flag.
I tried several things but I am not able to access anything in the chrome window. Is it possible to access the chrome gui components using pywinauto?
screenshot: ]1
Probably you use default backend="win32" which is used when you call Application(). To use MS UI Automation you have to set backend="uia" when instantiating Application object:
app = Application(backend='uia').start('chrome.exe <other params>')
My student wrote example script dragging file from explorer.exe to Google Drive in Chrome. Is it working for you?
P.S. If you already use backend='uia', please provide more detailed description with some code and output.

Copy variable from network tab preview in Chrome Dev Tools

I'm using the Chrome Dev Tools, and I am digging through the network pane to look at an XHR response with the preview tab. I want to grab a specific object from the preview. But when I try to store as global variable by right clicking preview object, the temp variable created was null.
I find that rather strange since the data is in memory (otherwise it wouldn't be displayed at all). Here's an example of a rather large response array that I'm trying to get a specific object from.
To clarify, I can store a variable that appears in my console. But I can't store a variable from the preview pane of the network tab. Is there any feature of the Chrome Dev Tools I'm overlooking, or am I forced to console log my XHR response and pull the object from there?
I'd really rather not add any console.log() or other breakpoints into my code just to have to remove them later. Digging through the super-long raw JSON response is also not practical. I'm using Chrome 47 on Windows 7.
I can get it to work by going:
Right click on the array index
"Store as global variable"
Then from the console, typing:
copy(temp1);
And then it will be on the clipboard.
Maybe a bit late, but you could go to response tab, copy the response content and then in the console just paste it after :
var response = <<paste here>>
i cant tell by the screenshot but you can then type response.data[64]

Automate Chrome console from Desktop app?

I'd like to be able to send info to the Chrome developer console from my application.
For example, my app has some json. I'd like this json to show up in either an existing, or newly created instance of the chrome dev tools console.
Is this possible? If so, any pointers to examples? Note that the platform should be any language, not just javascript. And definitely not a site already running in Chrome. I'm interested in implementing this in another process.
Do you thought of running your app in an environment which is pretty much like a browser?
Node.js
or (this is a whole webkit browser)
phantom.js
Otherwise you could call Chrome directly via commandline and try to simulate the dev tools key stroke like explained here:
Is there a command line argument in Chrome to start the developer tools on startup?
The command of displaying something in the Chrome console is e.g. console.log and it is at the end Javascript. All Console commands are described here:
https://developers.google.com/chrome-developer-tools/docs/console-api
The closest I've seen so far is this library:
https://github.com/ccampbell/chromelogger
which seems to allow logging to the Chrome Console from lots of other server side apis, but no desktop APIs.
This can be done on Mac using osascript. Save the following as a script and run it:
#!/usr/bin/osascript -l JavaScript
var chrome = Application('Google Chrome');
//chrome.activate();
chrome.includeStandardAdditions = true;
var currentTab = chrome.windows[0].activeTab()
currentTab.execute({javascript: 'console.log("Hello")'})

Debugging JSON using Chrome's Dev Tools

How do I access the results array from the following page using Google Chrome's console?
twitter.com/search.json?q=stackexchange
I keep getting this error:
ReferenceError: results is not defined
If what you really want is to browse this result set in a convinient way, just install one of JSON viewers for Chrome (preferably JSONView).
If you don't want to install any plugins, just run this:
JSON.parse($('.webkit-line-content').innerHTML);
in the console on page:
view-source:https://search.twitter.com/search.json?q=stackexchange
You can use console.debug() function in chrome console tab.
example:
console.debug(results)