(Aug-28-2023, 07:19 AM)cate16 Wrote: I got the following error:Now it try to parse.can be a problem with site in your country or speed of search.
Try set
time.sleep(3)
on line 17,to make it wait a bit before looking for tag.Sometime the network search can be to fast,time sleep is just a quick first test,Selenium has own Waits .
Here site that works for all,to make sure your setup works.
from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By import time # Setup #https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5795.0/win64/chromedriver-win64.zip options = Options() options.add_argument("--headless=new") ser = Service(r"C:\cmder\bin\chromedriver.exe") browser = webdriver.Chrome(service=ser, options=options) # Parse or automation url = 'https://www.python.org/' browser.get(url) python_about = browser.find_element(By.CSS_SELECTOR, '#touchnav-wrapper > header > div > div.introduction > p') print(python_about.text)
Output:Python is a programming language that lets you work quickly
and integrate systems more effectively. Learn More