Send JavaScript codes to the browser easily

Discuss other useful utilities, general computing tips & tricks, Internet resources, etc.
Posts: 14
Joined: 22 Jun 2019, 22:17

Send JavaScript codes to the browser easily

22 Jun 2019, 22:57


I searched extensively on how to submit javascript code to the browser. I tested imacros, kantu, katalon ... watched the videos of joe glines on selenium.

Then I discovered the addon called "Autofill", created by Tom Doan (http available for firefox and chrome. Broken Link for safety

As it says at the beginning of the Overview "The Autofill extension serves one purpose: fill fields automatically on page load without any interaction from the user. This is its primary function, but it can do so much more.[...]"

The addon allows you to create multiple profiles with javascript codes and assign shortcut keys to them, which can be easily triggered by simple "send," shortcut key "" by autohotkey.

I was impressed by the ease of use and quality of the extension

https /en/firefox/addon/autofill-quantum/ Broken Link for safety

https /webstore/detail/autofill/nlmmgnhgdeffjkdckmikfpnddkbbfkkk Broken Link for safety
User avatar
Posts: 101
Joined: 31 May 2018, 23:26

Re: Send JavaScript codes to the browser easily

28 Jun 2019, 00:18

Cool! Thanks for sharing this. I’ve been having some issues automating a website with Selenium, hopefully this will help me overcome that problem.
Posts: 14
Joined: 22 Jun 2019, 22:17

Re: Send JavaScript codes to the browser easily

10 Jul 2019, 22:01

:) it worked?
Posts: 1
Joined: 01 Nov 2019, 12:30

Re: Send JavaScript codes to the browser easily

02 Nov 2019, 09:42

You can also use Tampermonkey and JavaScript to automate stuff in the browser. Using an app called Unified Remote on my phone I can launch Spotify on a server in my house. The code below connects Spotify on the phone and server. Great for adding custom key binds to websites or automating stuff you do regularly.

Code: Select all

// ==UserScript==
// @name         Spotify
// @require      https /ajax/libs/jquery/3.1.0/jquery.min.js  Broken Link for safety
// @namespace    http /  Broken Link for safety
// @version      0.1
// @description  try to take over the world!
// @author       You
// @include      https*   Broken Link for safety
// @grant        none
// ==/UserScript==

// Your code here...
var spotInterval;
var $ = window.jQuery;
window.addEventListener("keydown", keysPressed, false);
window.addEventListener("keyup", keysReleased, false);

var keys = [];

function keysPressed(e) {
   // store an entry for every key pressed
    keys[e.keyCode] = true;

//        // Ctrl + shift+alt+q
   if (keys[17] && keys[18] && keys[16] && keys[81]) {

        // prevent default browser behavior


function keysReleased(e) {
    // mark keys that were released
    keys[e.keyCode] = false;

function spotifyConnect(){
spotInterval = setInterval( function()
        if ($('div.connect-device-list-item__info:contains("This Web Browser")').length>0){
        $('div.connect-device-list-item__info:contains("This Web Browser")').eq(0).trigger('click');
    }, 2000);

$( document ).ready(function() {
 setTimeout(function() {
    // Your code here
    //5 seconds after page loads, click the menu item to select what device music is played back from
}, 5000);
//function to check every 2 seconds if device list exists - it won't exist unless Spotify is running on your phone


Return to “Other Utilities & Resources”

Who is online

Users browsing this forum: No registered users and 6 guests