I see the particular site you've mentioned takes a long loading time, while many of the DOM elements are already visible/loaded.
My suggestion to you would be to use a Page Load Strategy
You can tell Selenium not to wait for the whole document to be fully loaded:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.page_load_strategy = 'eager' # or 'none'
driver = webdriver.Chrome(options=options)
driver.get("https://www.ambito.com/contenidos/dolar.html")
Here are the available page loading strategies:
"normal" (default): waits for full load.
"eager": waits only until DOMContentLoaded or a certain element.
"none": returns immediately after the first bytes arrive.
This website uses Cloudflare Human verification, so I would suggest using SeleniumBase , a wrapper around Selenium that can take care of it.
Here's a working example:
from seleniumbase import SB
url = "https://www.ambito.com/contenidos/dolar.html"
with SB(uc=True, page_load_strategy="eager", test=True) as sb:
sb.maximize_window()
sb.activate_cdp_mode(url)
sb.uc_gui_click_captcha() # handles potential CAPTCHA
nav_tab = sb.wait_for_element("nav.main-nav", timeout=5)
print(nav_tab.text.split())
output:
['Dólar', 'Economía', 'Finanzas', 'Política', 'Negocios', 'Opinión', 'Uruguay']
for example, in code above, if you just want to extract or test for the navigation bar element (nav.main-nav) to appear in DOM and close the browser right after that without waiting ages until the browser fully loads.