Skip to content

Instantly share code, notes, and snippets.

@niall-byrne
Last active June 3, 2021 01:20
Show Gist options
  • Save niall-byrne/8909729b20c8b4c20066838abe300bb9 to your computer and use it in GitHub Desktop.
Save niall-byrne/8909729b20c8b4c20066838abe300bb9 to your computer and use it in GitHub Desktop.
Globe and Mail Automation
var input = document.getElementsByClassName('bc-add-symbol-input')[0]
var button = document.getElementsByClassName('bc-button-gray')[0]
var values = "SYMBOL1 SYMBOL2".split(" ");
var event_enter = new KeyboardEvent("keydown", {
bubbles: true, cancelable: true, keyCode: 13
});
var event_input = new Event('input', {
bubbles: true,
cancelable: true,
});
values.forEach((item, index) => {
setTimeout(function () {
input.value = item;
input.dispatchEvent(event_input);
input.dispatchEvent(event_enter);
}, index * 500);
});
Automation for the Globe and Mail website.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment