Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Created May 7, 2018 17:03
Show Gist options
  • Save sergiolucero/8700545e8554a1ce605cbb043b7ab974 to your computer and use it in GitHub Desktop.
Save sergiolucero/8700545e8554a1ce605cbb043b7ab974 to your computer and use it in GitHub Desktop.
amazon_scraping
Instrucciones para selenium+gecko+firefox
sudo apt-get update
sudo apt-get install python # instalar python
sudo apt-get install python-pip # instalar pip
pip install selenium # instalar selenium
pip install pyvirtualdisplay # instalar pyvirtualdisplay
wget https://github.com/mozilla/geckodriver/releases/download/v0.20.1/geckodriver-v0.20.1-linux64.tar.gz
tar -xvzf geckodriver* # extraer geckodriver
chmod +x geckodriver
sudo cp geckodriver /usr/local/bin
sudo chmod +x /usr/local/bin/geckodriver
export PATH=$PATH:/usr/local/bin/geckodriver
sudo add-apt-repository ppa:ubuntu-mozilla-security/ppa
sudo apt-get update
sudo apt-get install firefox
sudo apt-get install xvfb firefox
############################################################################################
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from pyvirtualdisplay import Display
Display(visible=0, size=(1024, 768)).start()
binary = FirefoxBinary('/usr/bin/firefox')
opts = Options()
opts.set_headless()
assert opts.headless # operating in headless mode
link="https://www.santander.cl"
driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver',options=opts,firefox_binary = binary)
driver.get(link)
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment