-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrowser.py
More file actions
26 lines (19 loc) · 878 Bytes
/
browser.py
File metadata and controls
26 lines (19 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def init_browser():
# Inicializa o navegador Chrome
options = webdriver.ChromeOptions()
#options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
driver.maximize_window() # <-- aqui abre o navegador maximizado
driver.get("https://rpachallengeocr.azurewebsites.net/")
# supondo que driver já está aberto e carregou o site
wait = WebDriverWait(driver, 10) # timeout de 10 segundos
# esperar até o botão START estar clicável
start_button = wait.until(EC.element_to_be_clickable((By.ID, "start")))
# clicar no botão
start_button.click()
print("Botão START clicado com sucesso!")
return driver