Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var Browser = require('zombie');
var graph = require('fbgraph');
var city = 'Hamburg, Germany';
Browser.localhost('https://www.facebook.com');
var browser = Browser.create();
browser.visit('/login.php')
.then( function (error) {
// FB login
browser.fill('email', 'haw-mi@wegwerfemail.de');
browser.fill('pass', 'geheim123');
return browser.pressButton('login');
})
.done( function(error) {
// Form submitted, new page loaded.
//browser.assert.success();
// Suchfeld befüllen
//console.log(browser.text('._586j'));
function World() {
this.browser = zombie.create(); // this.browser will be available in step definitions
this.browser.silent = true;
this.host = 'http://localhost:'+ PORT;
this.setHost = function(host) {
this.host = host;
};
this.visit = function (path, callback) {
this.browser.visit(this.host + path, callback);
};
}
// Dependencies
var async = require('async');
var Browser = require('zombie');
var fs = require('fs');
var restify = require('restify');
var graph = require('./lib/graph.js');
const FB_EMAIL = "your@email.com";
const FB_PASSWORD = "YourSuperSecretPassword";
// bootstrap
Browser.localhost('https://www.facebook.com');
var browser = Browser.create();
var server = restify.createServer({
name: 'Grafari'
});
server.get('/searchPeopleByCity/:city', searchPeopleByCity);
server.head('/searchPeopleByCity/:city', searchPeopleByCity);
server.get('/searchPersonByName/:name', searchPersonByName);
server.head('/searchPersonByName/:name', searchPersonByName);
// program execution
async.series({
facebookLogin: function(callback) {
console.log('---\nloginFacebook');
var Zombie = require("zombie")
var fs = require("fs")
Zombie.localhost('https://www.facebook.com')
var browser = Zombie.create();
exports.browser = browser
if (fs.existsSync("./cookies.tmp")) {
console.log("Loading cookies from file...") //And omitting login
fs.readFile("./cookies.tmp", function(err, cookies) {
browser.loadCookies(cookies.toString())
browser.visit("/search/males", function(e) { //Browser must visit a page
if (e)
console.log("Error while loading file: " + JSON.stringify(e))
else
console.log("Page loaded")
})
})
} else { //Default login procedure
console.log("Missing cookie file")
function startBrowser(callback) {
var browser = Zombie.create();
if (fs.existsSync("./cookies.tmp")) {
console.log("Loading cookies from file...") //And omitting login
fs.readFile("./cookies.tmp", function(err, cookies) {
browser.loadCookies(cookies.toString())
browser.visit("/", function(e) { //Browser must visit a page
return callback(e, browser)
})
})
} else { //Default login procedure
async.series([
function(cb) {
browser.visit('/login.php', cb);
},
this.World = function World(callback) {
this.browser = Zombie.create({runScripts: true, debug: false});
callback();
};