You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.0 KiB
106 lines
3.0 KiB
const selenium = require('selenium-webdriver');
|
|
const delay = (ms) => {
|
|
return new Promise((resolve) => {
|
|
setTimeout(resolve, ms);
|
|
});
|
|
}
|
|
let driver;
|
|
|
|
const myInstanceIDs = [200339, 199169, 197195, 195883, 194294, 188057, 181297];
|
|
|
|
const login = async ()=> {
|
|
driver = await new selenium.Builder().forBrowser('chrome').build();
|
|
await driver.get('https://outcomes.generalassemb.ly/');
|
|
|
|
let selection = selenium.By.id('identify_email');
|
|
let element = await driver.findElement(selection);
|
|
element.sendKeys('matt.huntington@generalassemb.ly');
|
|
|
|
selection = selenium.By.id('baseForm');
|
|
element = await driver.findElement(selection);
|
|
element.submit();
|
|
|
|
await delay(2000);
|
|
|
|
selection= selenium.By.css('input[type="text"]');
|
|
element = await driver.findElement(selection);
|
|
element.sendKeys('matt.huntington@generalassemb.ly');
|
|
|
|
selection= selenium.By.css('input[type="password"]');
|
|
element = await driver.findElement(selection);
|
|
element.sendKeys('Hunt!ngt0n80!');
|
|
|
|
selection = selenium.By.css('form');
|
|
element = await driver.findElement(selection);
|
|
element.submit();
|
|
|
|
await delay(2000);
|
|
|
|
selection= selenium.By.css('a')
|
|
let elements = await driver.findElements(selection);
|
|
|
|
elements[1].click();
|
|
}
|
|
|
|
const search = async () => {
|
|
let selection = selenium.By.id('program');
|
|
let element = await driver.findElement(selection);
|
|
let select = new selenium.Select(element);
|
|
await select.selectByVisibleText('Software Engineering Immersive Remote');
|
|
|
|
selection = selenium.By.id('metro');
|
|
element = await driver.findElement(selection);
|
|
select = new selenium.Select(element);
|
|
await select.selectByVisibleText('Online');
|
|
|
|
selection = selenium.By.id('from');
|
|
element = await driver.findElement(selection);
|
|
element.sendKeys('01/01/2021');
|
|
|
|
selection = selenium.By.id('filter-form');
|
|
element = await driver.findElement(selection);
|
|
element.submit();
|
|
}
|
|
const main = async () => {
|
|
await login();
|
|
await delay(8000);
|
|
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);
|
|
let 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]);
|
|
|
|
selection = selenium.By.css('p.course-header__detail');
|
|
element = await driver.findElement(selection);
|
|
innerHTML = await element.getAttribute('innerHTML');
|
|
const graduationDate = new Date(innerHTML.split(' - ')[1]);
|
|
|
|
if(myInstanceIDs.includes(instanceID)){
|
|
console.log("me -->", instanceID, graduationDate, percent);
|
|
} else {
|
|
console.log(instanceID, graduationDate, percent);
|
|
}
|
|
} catch (error) {
|
|
//console.log(error);
|
|
}
|
|
|
|
await driver.navigate().back();
|
|
}
|
|
}
|
|
main()
|