botbotbot 's blog

Robot Packtpub

Automate claim free ebook from packtpub to your packtpub account by robotframework script.

Robot Script

Package Requirements or Dockerfile on Robot-packtpub Repo

# ubuntu
$ apt-get -y update
$ apt-get -y install python-dev python-pip
$ apt-get install -y phantomjs libicu52 wget
$ wget https://raw.githubusercontent.com/Pyppe/phantomjs2.0-ubuntu14.04x64/master/bin/phantomjs -O /usr/bin/phantomjs && chmod +x /usr/bin/phantomjs

$ pip install robotframework
$ pip install robotframework-selenium2library

How to use

# Edit {USER} and {PASSWORD} first !!!
$ pybot robot-packtpub.txt

Note

  • We use XPath to locate where button and input form are that not flexible, It may change when Web UI changed (XPath is Best Solution that I found). You can find XPath by following this video - Quick Tip: Getting The XPath In Google Chrome.

  • PhantomJS2.0 fixed this issue We use Xvfb Firefox for headless browser instead of PhantomJS that have some problem on docker in this case.

  • You can use Travis-CI and Nightly Builds to run your script everyday - See demo here.