Skip to content

Instantly share code, notes, and snippets.

@Syakhisk
Created November 27, 2023 06:37
Show Gist options
  • Save Syakhisk/3080d56bb5fa832b80bce1eed180f09e to your computer and use it in GitHub Desktop.
Save Syakhisk/3080d56bb5fa832b80bce1eed180f09e to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Workday Auto Login
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://wd3.myworkday.com/wday/authgwy/gojek/login.*
// @icon https://www.google.com/s2/favicons?sz=64&domain=workday.com
// @grant none
// @run-at document-end
// @noframes
// ==/UserScript==
function main() {
// Your code here...
const el = document.querySelector(
"[data-automation-id=authPanel] [data-automation-id=authSelectorOption]",
);
if (!el) {
console.log("TamperMonkey: 'Login with SSO' button not found");
return;
}
if (el.innerText.trim() == "Login with SSO") {
el.click();
}
}
(async function () {
"use strict";
console.log("TamperMonkey: Running...");
// Wait for some period since the page probably would not load all the data yet (ajax page/spa)
await new Promise((resolve) => setTimeout(resolve, 500));
// Run main function every 500ms, to mitigate if the page is not working
setInterval(main, 500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment