Selenium 出现错误

```

from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get('https://www.zhipin.com/guangzhou/?ka=header-home%27)
driver.implicitly_wait(10)
driver.find_element(By.CLASS_NAME, 'ipt-search').send_keys('python')
driver.find_element(By.CLASS_NAME, 'btn-search').click()
lis = driver.find_elements(By.CSS_SELECTOR,".job-list-box")
for li in lis:
company = li.find_element(By.CLASS_NAME, 'company-name').text
print(company)

```各位大佬,为什么只能打开网页,但去不能输出!

输出定位返回的内容看是不是有返回值,或者使用Service

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

s = Service(r"浏览器.exe所在路径")  # ==========
# driver = webdriver.Chrome()
driver = webdriver.Chrome(service=s)  # ========
driver.get('https://www.zhipin.com/guangzhou/?ka=header-home%27')
driver.implicitly_wait(10)
driver.find_element(By.CLASS_NAME, 'ipt-search').send_keys('python')
driver.find_element(By.CLASS_NAME, 'btn-search').click()
lis = driver.find_elements(By.CSS_SELECTOR, ".job-list-box")
for li in lis:
    company = li.find_element(By.CLASS_NAME, 'company-name').text
    print(company)


selenium 4.4.0 chrome 104亲测可以打印出来,看了一下是由于你没加header,而且等待时间也不对

https://registry.npmmirror.com/binary.html?path=chromedriver/104.0.5112.79/
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

options = webdriver.ChromeOptions()
options.add_argument('Referer="https://www.zhipin.com/web/geek/job?query=python&city=101280100"')
options.add_argument('sec-ch-ua="Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104"')
options.add_argument('sec-ch-ua-platform="macOS"')
options.add_argument('sec-ch-ua-mobile="?0"')
options.add_argument('User-Agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36')

s = Service("./chromedriver")  # ==========
# driver = webdriver.Chrome()
driver = webdriver.Chrome(service=s,chrome_options=options)  # ========
driver.get('https://www.zhipin.com/guangzhou/')
driver.implicitly_wait(10)
driver.find_element(By.CLASS_NAME, 'ipt-search').send_keys('python')
driver.find_element(By.CLASS_NAME, 'btn-search').click()
driver.implicitly_wait(10)
lis = driver.find_elements(By.CSS_SELECTOR, ".job-list-box")
driver.implicitly_wait(10)
for li in lis:
    company = li.find_element(By.CLASS_NAME, 'company-name').text
    print(company)

header的取法如下图,看图中箭头:

img