Skip to content

Instantly share code, notes, and snippets.

@rhzs
Last active August 29, 2015 14:26
Show Gist options
  • Save rhzs/3dd9f39dd1e2570b531f to your computer and use it in GitHub Desktop.
Save rhzs/3dd9f39dd1e2570b531f to your computer and use it in GitHub Desktop.
Using capybara and poltergeist to pull lazada site
# This is an example - the usage of capybara and poltergeist to take screenshot of e-commerce website
# Later the implementation can be extended to pull data from the e-commerce website.
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'capybara/poltergeist'
Capybara.run_server = false
Capybara.current_driver = :poltergeist
Capybara.app_host = 'http://www.lazada.co.id' # Indonesia e-commerce Lazada Site
module LazadaPuller
class Lazada
include Capybara::DSL
def beli_smartphone
visit('/')
page.save_screenshot('lazada.png')
end
end
end
t = LazadaPuller::Lazada.new
t.beli_smartphone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment