From f3e3242b7c8c312d4aa8269862cb78a266a965a9 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Thu, 14 Sep 2023 22:11:51 -0400 Subject: [PATCH] getting date --- scrape.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scrape.js b/scrape.js index 5f5ef58..179abe1 100644 --- a/scrape.js +++ b/scrape.js @@ -79,14 +79,21 @@ const main = async () => { try{ selection = selenium.By.css('.full-time-90-days-actuals'); let element = await driver.findElement(selection); - const innerHTML = await element.getAttribute('innerHTML'); + 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, percent); + console.log("me -->", instanceID, graduationDate, percent); } else { - console.log(instanceID, percent); + console.log(instanceID, graduationDate, percent); } } catch (error) { //console.log(error);