So I've already added the required build packs to my Heroku app. My app.js file has the correct imports (I believe) and I thought I was implementing the function correctly, but I guess I'm not. FYI, I'm calling the scraping function every minute using a cron schedule function.
const webdriver = require('selenium-webdriver');
require('chromedriver');
const chrome = require('selenium-webdriver/chrome');
let options = new chrome.Options();
options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.addArguments("--no-sandbox");
function scrape() {
let driver = new webdriver.Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.build();
driver.get('https://www.selenium.dev/documentation/en/webdriver/web_element/');
let elements = driver.findElements(By.css('p'));
for(let e of elements) {
console.log(e.getText());
}
driver.quit();
};
and in my cron function I just call
scrape()
Cron runs a couple times and then I get this weird error: