Skip to content

Commit

Permalink
Fix: Adjust Chrome and Chromedriver installation in GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rociobenitez committed Jan 6, 2025
1 parent bad539f commit 97b79ea
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/fotocasa-scraper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 9 * * 1" # Ejecutar todos los lunes a las 9:00 UTC

Expand All @@ -23,11 +26,30 @@ jobs:
- name: Install dependencies
run: pip install -r requirements.txt

- name: Install Google Chrome and Chromedriver
- name: Find Google Chrome binary
run: |
which google-chrome || echo "google-chrome not found"
which chromium || echo "chromium not found"
which chromedriver || echo "chromedriver not found"
echo "Chromium version:"
chromium --version || echo "Chromium not installed"
echo "Google Chrome version:"
google-chrome --version || echo "Google Chrome not installed"
echo "Chromedriver version:"
chromedriver --version || echo "Chromedriver not installed"
- name: Install Chrome and Chromedriver
run: |
sudo apt-get update
sudo apt-get install -y google-chrome-stable
sudo apt-get install -y wget
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y ./google-chrome-stable_current_amd64.deb
sudo apt-get install -y chromium-chromedriver
ln -s /usr/bin/chromedriver /usr/local/bin/chromedriver
echo "Google Chrome version:"
google-chrome --version
echo "Chromedriver version:"
chromedriver --version
- name: Verify Chromium installation
run: |
Expand Down
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
from selenium.webdriver.common.by import By
from bs4 import BeautifulSoup

# Mantener el navegador abierto después de que el programa termine
# Configurar el servicio de Chromedriver
chrome_service = Service()

# Configurar opciones de Chrome
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("detach", True)
chrome_options.binary_location = "/snap/bin/chromium"
chrome_options.add_argument("--headless") # Ejecutar en modo sin interfaz
chrome_options.add_argument("--no-sandbox") # Solución para problemas de entorno
chrome_options.add_argument("--disable-dev-shm-usage") # Solución para problemas de memoria compartida
Expand Down

0 comments on commit 97b79ea

Please sign in to comment.