0
How to use Selenium without opening the browser?
I used a code I saw right here, options.add_argument("--headless")
, and also options.set_headless(True)
, but makes that mistake:
Selenium.common.exceptions.Nosuchelementexception: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="Contentplaceholder1_spanclosingprice"]"}
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("headless")
driver = webdriver.Chrome(chrome_options=options)
driver.get("https://etherscan.io/tx/0xcc22fc0c43eb8c6a88ce92fd344108cf8f690c21da57a3fb0d8dadcd207d5de3")
resultado = driver.find_element_by_xpath('//*[@id="ContentPlaceHolder1_spanClosingPrice"]').text
print(resultado)
driver.quit()
What to do? I’m using Python.
Note: when I let open the browser he thinks right.
Could you please put the code so that we can better understand your problem? Thank you!
– João Victor Sierra
I put the code!
– Amanda Nunes