Last active
August 29, 2015 14:26
-
-
Save rhzs/3dd9f39dd1e2570b531f to your computer and use it in GitHub Desktop.
Using capybara and poltergeist to pull lazada site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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