5

Specifically I am not interested in running selenium, phantomjs, chrome, or any sort of virtual framebuffer like xvfb.

As of v56 it is possible via:

firefox -headless

Is it possible to run something as simple as:

firefox -headless some.js | grep -ioh 'stackoverflow' | wc -l

disregarding any sort of timing ... some.js:

location.href="https://stackoverflow.com"
console.log(document.body);

I haven't been able to find a good answer in regards to controlling it other than via looking at the source code for https://github.com/saucelabs/foxdriver:

➜  /Users/jmunsch/Desktop/public_dev /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin -headless 'javascript:location.href="https://ebay.com"'
*** You are running in headless mode.
[OSVR] Failed to load OSVR Util library!
[OSVR] Failed to load OSVR Util library!
2017-12-13 18:25:23.147 plugin-container[81081:12271051] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0xb93b, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-12-13 18:25:23.148 plugin-container[81081:12271051] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0xbc03, name = 'com.apple.CFPasteboardClient'
See /usr/include/servers/bootstrap_defs.h for the error codes.
1513218323615   addons.webextension.jid1-ZAdIEUB7XOzOJw@jetpack WARN    Please specify whether you want browser_style or not in your browser_action options.
Extension error: TypeError: tab.url is undefined moz-extension://73977042-24a6-4741-8f43-9c6dc9c5677e/js/tabManager.js 96
[[Exception stack
@moz-extension://73977042-24a6-4741-8f43-9c6dc9c5677e/js/tabManager.js:96:1
Current stack
runSafeSyncWithoutClone@resource://gre/modules/ExtensionUtils.jsm:63:129
runSafeWithoutClone@resource://gre/modules/ExtensionCommon.jsm:174:38
fire@resource://gre/modules/ExtensionChild.jsm:763:71
receiveMessage@resource://gre/modules/ExtensionChild.jsm:765:76
_callHandlers/<@resource://gre/modules/MessageChannel.jsm:587:17
_callHandlers@resource://gre/modules/MessageChannel.jsm:586:14
_handleMessage/deferred.promise<@resource://gre/modules/MessageChannel.jsm:651:7
_handleMessage@resource://gre/modules/MessageChannel.jsm:648:24
receiveMessage@resource://gre/modules/MessageChannel.jsm:163:5
]]
^C** Unknown exception behavior: -2147483647

FF version:

➜  /Users/jmunsch/Desktop/public_dev  /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin  --version
Mozilla Firefox 56.0a1

It looks like I have to parse a streaming socket for json, is there an async pythonic version to do this:

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.