Created
December 3, 2018 23:40
-
-
Save jamesr2323/c896e22f5511e4162ae789d085e58264 to your computer and use it in GitHub Desktop.
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
require 'selenium-webdriver' | |
require 'json' | |
require 'csv' | |
require 'active_support/all' | |
options = Selenium::WebDriver::Chrome::Options.new | |
options.add_argument('--headless') # Remove this to watch the browser in testing | |
options.add_argument(%Q{--user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"}) | |
options.add_argument("--blink-settings=imagesEnabled=false") | |
driver = Selenium::WebDriver.for(:chrome, options: options) | |
driver.get("https://www.example.com") | |
10.times do | |
driver.execute_script("window.scrollBy(0,2000)") | |
sleep 2 | |
end | |
# Do something to load data from page here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment