Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alex_viderman authored and alex_viderman committed Jul 10, 2017
1 parent a730b54 commit a37c2ce
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ typings/
# dotenv environment variables file
.env

.idea
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node index.js
22 changes: 22 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "Heroku Selenium Node",
"env": {

},
"formation": {
"web": {
"quantity": 1,
"size": "Free"
}
},
"addons": [
],
"buildpacks": [
{
"url": "http://github.com/heroku/heroku-buildpack-nodejs.git"
},
{
"url": "https://github.com/stomita/heroku-buildpack-phantomjs"
}
]
}
30 changes: 30 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var webdriver = require('selenium-webdriver');
var express = require('express')
var app = express()

var port = process.env.PORT || 14000;
var By = webdriver.By;

app.get('/test', function (req, res) {
var driver = new webdriver.Builder()
.forBrowser('phantomjs')
.build();
driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys('webdriver');
driver.findElement(By.name('btnG')).click();
driver.wait(function() {
return driver.getTitle().then(function(title) {
console.log(title);
return title === 'webdriver - Google Search';
});
}, 5000).then(function() {
res.status(200).send('Done');
}, function(error) {
res.status(200).send(error);
});
driver.quit();
});

app.listen(port, function () {
console.log('Example app listening on port: ',port)
})
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "untitled2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.15.2",
"selenium-webdriver": "^3.4.0"
},
"engines": {
"node": "6.10.3",
"npm": "4.5.0"
}
}

0 comments on commit a37c2ce

Please sign in to comment.