Skip to content

Instantly share code, notes, and snippets.

@slowkow
Created January 10, 2019 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slowkow/e0570d878e89732b8a166d79e1847bcc to your computer and use it in GitHub Desktop.
Save slowkow/e0570d878e89732b8a166d79e1847bcc to your computer and use it in GitHub Desktop.
Chrome extension to automatically click the "Send SMS" button on okta.com
/*
* The purpose of this script is to automatically click the "Send SMS"
* button as soon as the page is loaded, instead of clicking on it manually.
*
* This is the page with the button:
*
* https://partnershealthcare.okta.com/signin/verify/okta/sms
*
*/
// Run main() after the page is loaded
window.addEventListener('load', main, false);
function main(event) {
// Every 1000 ms, run try_click()
var timer = setInterval(try_click, 1000);
// Stop trying after 10 attempts.
var max_attempts = 10;
function try_click() {
max_attempts -= 1;
if (max_attempts > 0) {
clearInterval(timer);
console.log("Attempts left: " + max_attempts);
// Find the button.
var b = document.querySelector(".sms-request-button");
// If we found the button, click on it.
if (b) {
max_attempts = 0;
console.log("Clicking on sms button");
b.click();
}
}
}
}
{
"name": "autoclick",
"version": "1.0",
"manifest_version": 2,
"permissions": [
"activeTab"
],
"content_scripts": [
{
"matches": [
"https://partnershealthcare.okta.com/*"
],
"js": ["contentScript.js"],
"css": ["mycss.css"]
}
]
}
body {
background: linear-gradient(#9198e51c, #e6646538) !important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment