Skip to content

Instantly share code, notes, and snippets.

@allquixotic
Last active May 3, 2018 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allquixotic/a2876b33f2a87ee9fc2234b237858ad3 to your computer and use it in GitHub Desktop.
Save allquixotic/a2876b33f2a87ee9fc2234b237858ad3 to your computer and use it in GitHub Desktop.
Cavil 2018 stuff
  • ~/dev: Base dir where everything is.
  • ~/dev/SO-ChatBot: git clone https://github.com/allquixotic/SO-ChatBot
  • run-headless.config.json: drop in ~/dev/SO-ChatBot
  • run-headless.sh: drop in ~/dev

Steps:

  • Extract firefox latest .tar.bz2 (with "firefox" folder inside) to ~/dev/firefox. Firefox binary should be ~/dev/firefox/firefox/firefox (we have to say firefox three times to summon @Bob-refox) - known working with Firefox 59.0.3
  • Update geckodriver version (download from Github) and WebdriverIO in SO-ChatBot/package.json to use newer Firefox, as they are both fairly tightly coupled to the Firefox version
  • Extract geckodriver binary into ~/dev/firefox (known working with 0.20.1)
  • Don't need selenium-server-standalone anymore, or Java
  • Need Node 6.x or later (use LTS)
  • In ~/dev/SO-ChatBot: run npm install to grab WebdriverIO dependency
  • Need GNU screen installed
  • Don't need an X server
  • ~/dev/firefox/ffprofile is where the Firefox profile will be stored. Not sure if FF creates this dir if it doesn't exist, but if it doesn't, you need to mkdir it
  • Obviously if your username isn't "sean", s/sean/whatever/g in everything
{
"email": "put Cavil's email here",
"password": "put Cavil's password here",
"siteUrl": "https://stackexchange.com",
"roomUrl": "https://chat.stackexchange.com/rooms/118",
"loginUrl": "http://stackexchange.com/users/login",
"scriptUrl": "http://localhost/master.js",
"driverOptions": {
"path": "/",
"desiredCapabilities": {
"moz:firefoxOptions": {
"binary": "/home/sean/dev/firefox/firefox/firefox",
"prefs": {
"security.mixed_content.block_active_content": false
},
"args": ["--headless", "--profile", "/home/sean/dev/firefox/ffprofile"]
}
}
}
}
#!/bin/bash
killall firefox geckodriver nodejs >& /dev/null
sleep 1
killall -9 firefox geckodriver nodejs >& /dev/null
screen -mdS gecko firefox/geckodriver --marionette-port 33333
sleep 5
screen -mdS bot nodejs SO-ChatBot/run-headless-webdriver.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment