Spaces:
Runtime error
Runtime error
Commit
·
f321eca
1
Parent(s):
6236e4f
chore: Update Chrome options and ChromeDriver version in app.py and Dockerfile
Browse files
app.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
-
import os
|
2 |
|
3 |
import logging
|
4 |
import time
|
5 |
from selenium import webdriver
|
6 |
from selenium.webdriver.chrome.service import Service
|
|
|
7 |
from webdriver_manager.chrome import ChromeDriverManager
|
8 |
from selenium.webdriver.common.by import By
|
9 |
from selenium.webdriver.support.ui import WebDriverWait
|
@@ -12,23 +13,24 @@ from selenium.webdriver.support import expected_conditions as EC
|
|
12 |
from datetime import datetime
|
13 |
import calendar
|
14 |
|
|
|
|
|
|
|
15 |
# Inicializar o driver do Selenium com o ChromeDriverManager
|
16 |
print("Instalando o ChromeDriver...", end="\n")
|
17 |
chromedriver_path = ChromeDriverManager().install()
|
18 |
-
print("ChromeDriver instalado com sucesso em " + chromedriver_path + "!",
|
19 |
-
end="\n")
|
20 |
|
21 |
-
options =
|
22 |
options.add_argument('--no-sandbox')
|
23 |
options.add_argument('--disable-dev-shm-usage')
|
24 |
options.add_argument('--disable-gpu')
|
25 |
options.add_argument('--disable-setuid-sandbox') # Adicione esta linha
|
26 |
-
driver = webdriver.Chrome(options=options
|
27 |
|
28 |
# Habilitar a captura de requisições de rede
|
29 |
driver.execute_cdp_cmd('Network.enable', {})
|
30 |
|
31 |
-
|
32 |
# Função para encontrar um elemento usando o XPath
|
33 |
def find(xpath):
|
34 |
return WebDriverWait(driver, 20).until(
|
|
|
1 |
+
import os
|
2 |
|
3 |
import logging
|
4 |
import time
|
5 |
from selenium import webdriver
|
6 |
from selenium.webdriver.chrome.service import Service
|
7 |
+
from selenium.webdriver.chrome.options import Options
|
8 |
from webdriver_manager.chrome import ChromeDriverManager
|
9 |
from selenium.webdriver.common.by import By
|
10 |
from selenium.webdriver.support.ui import WebDriverWait
|
|
|
13 |
from datetime import datetime
|
14 |
import calendar
|
15 |
|
16 |
+
from dotenv import load_dotenv
|
17 |
+
load_dotenv()
|
18 |
+
|
19 |
# Inicializar o driver do Selenium com o ChromeDriverManager
|
20 |
print("Instalando o ChromeDriver...", end="\n")
|
21 |
chromedriver_path = ChromeDriverManager().install()
|
22 |
+
print("ChromeDriver instalado com sucesso em " + chromedriver_path + "!", end="\n")
|
|
|
23 |
|
24 |
+
options = Options()
|
25 |
options.add_argument('--no-sandbox')
|
26 |
options.add_argument('--disable-dev-shm-usage')
|
27 |
options.add_argument('--disable-gpu')
|
28 |
options.add_argument('--disable-setuid-sandbox') # Adicione esta linha
|
29 |
+
driver = webdriver.Chrome(options=options)
|
30 |
|
31 |
# Habilitar a captura de requisições de rede
|
32 |
driver.execute_cdp_cmd('Network.enable', {})
|
33 |
|
|
|
34 |
# Função para encontrar um elemento usando o XPath
|
35 |
def find(xpath):
|
36 |
return WebDriverWait(driver, 20).until(
|