Skip to content

Commit

Permalink
Automate process using Selenium and nodemon
Browse files Browse the repository at this point in the history
  • Loading branch information
dnhn committed Apr 14, 2020
1 parent 0180407 commit 9a3bf62
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ app.use(proxy(FAH, {
}));
app.listen(PORT, () => console.log(`Proxy is running at ${HOST}:${PORT}\n`));

require('./browse');

module.exports = app;
14 changes: 14 additions & 0 deletions browse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const webdriver = require('selenium-webdriver');
require('chromedriver');

const driver = new webdriver.Builder()
.forBrowser('chrome')
.setChromeOptions({ args: ['--headless'] })
.build();

driver.get('http://127.0.0.1:4444');
driver.manage().window().minimize();

setInterval(() => {
driver.findElement(webdriver.By.id('slots')).click();
}, 120000);
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
"private": true,
"main": "app.js",
"scripts": {
"start": "node app.js"
"start": "nodemon app.js"
},
"dependencies": {
"chromedriver": "81.0.0",
"express": "4.16.1",
"express-http-proxy": "1.6.0"
"express-http-proxy": "1.6.0",
"nodemon": "2.0.3",
"selenium-webdriver": "4.0.0-alpha.7"
},
"nodemonConfig": {
"delay": 5000,
"ext": "js"
}
}

0 comments on commit 9a3bf62

Please sign in to comment.