0

I've made a node.js script like this:

const { Builder, By, Key, until } = require('selenium-webdriver');

const driver = new Builder().forBrowser("firefox").build();

const search_query = 'tigers';

(async () => {
    await driver.get(`https://www.google.com/search?q=${search_query}`);

    const h3Elements = await driver.findElements(By.css('h3'));
    for (const h3 of h3Elements) {
        console.log(await h3.getText());
    }

    console.log('...Task Complete!')
})();

and now I want to test it on a heroku server

but sadly I have no experience or understanding when it comes to setup

I tried following these link:
How to use Selenium Webdriver on Heroku?
How to run Selenium-Webdriver on Heroku with node.js (Firefox or Chrome)

but neither are for firefox
so how do I launch the above script on a heroku server? and what exactly is the process that is going on when it comes to web drivers on the server?

EDIT

I've added https://github.com/hamitaksln/heroku-integrated-firefox-geckodriver as a build pack

and set configuration vars as such:

FIREFOX_BIN=/app/vendor/firefox/firefox

GECKODRIVER_PATH=/app/vendor/geckodriver/geckodriver

LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib:/app/vendor

PATH=/usr/local/bin:/usr/bin:/bin:/app/vendor/

but it still shows an ERROR of incorrect path to geckodriver

  • Why would you test it on heroku? I ask, because both github and gitlab offer configurable CI, making the choice of heroku for this... unusual? – Mike 'Pomax' Kamermans Jun 11 '21 at 03:35
  • Get this to work in docker, set the heroku *stack* to `container` and deploy using docker on heroku – FalseDev Jun 11 '21 at 06:02
  • @Mike'Pomax'Kamermans could you explain more of what you mean? I'm relatively new to web development I usually work on applications –  Jun 11 '21 at 07:53
  • @FalseDev could you provide the appropriate links for what you're saying? –  Jun 11 '21 at 07:54
  • @cakelover [here](https://devcenter.heroku.com/categories/deploying-with-docker) it is – FalseDev Jun 11 '21 at 09:10

0 Answers0