Last active
June 26, 2021 10:23
-
-
Save Royce/887fa9aced3bc000756f8447c5b53e7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function byId(id) { | |
return document.querySelectorAll(`[data-bi-id=${id}]`)[0] | |
} | |
function text(el) { | |
return el?.textContent || el?.innerText | |
} | |
function currentPage() { | |
el = document.querySelectorAll('.SiteNavigation__link--active')[0] | |
return text(el) | |
} | |
function parentElementWithLabel(el, label) { | |
return [...el.querySelectorAll("label")] | |
.filter(l => text(l) === label)[0] | |
?.parentElement | |
} | |
byId("home-timesheet-widget-clock-in-button").click() | |
modal = document.getElementById("fabricModalContent") | |
rows = modal.querySelectorAll(".AddEditEntry__clocks") | |
parentElementWithLabel(rows[0], "Start Time").querySelector("input").value = "9:00" | |
parentElementWithLabel(rows[0], "End Time").querySelector("input").value = "18:00" | |
document.addEventListener("keydown", console.log) | |
ke80 = document.createEvent("KeyboardEvent"); | |
ke80.initKeyboardEvent("keypress", true, true, window, 'p', 'p', false, false, 80, 0); | |
e = new KeyboardEvent("keydown", {bubbles : true, cancelable : true, key : "a", char : "a", shiftKey : true}); | |
parentElementWithLabel(rows[0], "End Time").querySelector("[role=button]").dispatchEvent(e); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment