Created
August 16, 2017 08:12
-
-
Save stalniy/cbd08db1472c41d35b9e751022333bb6 to your computer and use it in GitHub Desktop.
Submit google form
This file contains hidden or 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 c(name) { | |
return $x(`//div[@role="listitem" and @jscontroller and .//*[@role="heading" and text()[contains(., "${name}")]]]`)[0]; | |
} | |
function report(attrs) { | |
const name = c('Name'); | |
name.click(); | |
setTimeout(() => { | |
const option = $x(`//*[@role=option and .//text()[contains(., "${attrs.name}")]]`, name)[0]; | |
if (!option) { | |
alert(`Unable to find ${attrs.name}`); | |
return; | |
} | |
option.click(); | |
const type = c('Shift is'); | |
if (attrs.isStarted) { | |
$x('//*[@role="radio" and ..//*[contains(text(), "Started")]]/..', type)[0].click(); | |
} else { | |
$x('//*[@role="radio" and ..//*[contains(text(), "Ended")]]/..', type)[0].click(); | |
} | |
setTimeout(() => { | |
// TODO: click on "Submit" button | |
}, 1000); | |
}, 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment