master
Matt Huntington 2 years ago
parent bbd3a28a81
commit 3216f34646

@ -5,16 +5,19 @@ const delay = (ms) => {
}); });
} }
let driver; let driver;
const myInstanceIDs = [200339, 199169, 197195, 195883, 194294, 188057, 181297];
const login = async ()=> { const login = async ()=> {
driver = await new selenium.Builder().forBrowser('chrome').build(); driver = await new selenium.Builder().forBrowser('chrome').build();
await driver.get('https://outcomes.generalassemb.ly/'); await driver.get('https://outcomes.generalassemb.ly/');
let selection = selenium.By.id('identify_email'); let selection = selenium.By.id('identify_email');
let element = driver.findElement(selection); let element = await driver.findElement(selection);
element.sendKeys('matt.huntington@generalassemb.ly'); element.sendKeys('matt.huntington@generalassemb.ly');
selection = selenium.By.id('baseForm'); selection = selenium.By.id('baseForm');
element = driver.findElement(selection); element = await driver.findElement(selection);
element.submit(); element.submit();
await delay(2000); await delay(2000);
@ -28,39 +31,68 @@ const login = async ()=> {
element.sendKeys('Hunt!ngt0n80!'); element.sendKeys('Hunt!ngt0n80!');
selection = selenium.By.css('form'); selection = selenium.By.css('form');
element = driver.findElement(selection); element = await driver.findElement(selection);
element.submit(); element.submit();
await delay(2000); await delay(2000);
selection= selenium.By.css('a') selection= selenium.By.css('a')
element = await driver.findElements(selection); let elements = await driver.findElements(selection);
element[1].click(); elements[1].click();
} }
const search = async () => { const search = async () => {
let selection = selenium.By.id('program'); let selection = selenium.By.id('program');
let element = driver.findElement(selection); let element = await driver.findElement(selection);
let select = new selenium.Select(element); let select = new selenium.Select(element);
await select.selectByVisibleText('Software Engineering Immersive Remote'); await select.selectByVisibleText('Software Engineering Immersive Remote');
selection = selenium.By.id('metro'); selection = selenium.By.id('metro');
element = driver.findElement(selection); element = await driver.findElement(selection);
select = new selenium.Select(element); select = new selenium.Select(element);
await select.selectByVisibleText('Online'); await select.selectByVisibleText('Online');
selection = selenium.By.id('from'); selection = selenium.By.id('from');
element = driver.findElement(selection); element = await driver.findElement(selection);
element.sendKeys('01/01/2021'); element.sendKeys('01/01/2021');
selection = selenium.By.id('filter-form'); selection = selenium.By.id('filter-form');
element = driver.findElement(selection); element = await driver.findElement(selection);
element.submit(); element.submit();
} }
const main = async () => { const main = async () => {
await login(); await login();
await delay(10000); await delay(8000);
search(); await search();
await delay(2000);
let selection = selenium.By.css('table td>a');
let elements = await driver.findElements(selection);
for(currentElement of elements){
currentElement.click();
await delay(3000);
try{
selection = selenium.By.css('.full-time-90-days-actuals');
let element = await driver.findElement(selection);
const innerHTML = await element.getAttribute('innerHTML');
const percent = parseInt(innerHTML.match(/([0-9]*%)/)[0].replace('%',''))
const url = await driver.getCurrentUrl();
const instanceID = parseInt(url.match(/[0-9]*$/i)[0]);
if(myInstanceIDs.includes(instanceID)){
console.log("me -->", instanceID, percent);
} else {
console.log(instanceID, percent);
}
} catch (error) {
//console.log(error);
}
await driver.navigate().back();
}
} }
main() main()

Loading…
Cancel
Save