python 中的 Web 自动化错误,而 运行..我正在使用 selenium

Web automation error in python while running..i m using selenium

我刚开始 Web 自动化,我无法弄清楚这个错误.. 代码-

from selenium import webdriver

site = webdriver.Chrome()
site.get('https://www.youtube.com')
searchbar = site.find_element_by_xpath('//*[@id="search"]')
searchbar.click()
searchbar.send_keys('Fireproof')

searchButton = site.find_element_by_xpath('//*[@id="search-icon-legacy"]')
searchButton.click()

Error in cmd-

正在打开浏览器,但之后什么也没做

问题出在 XPath,用户下面的代码更新了 XPath。

searchbar = driver.find_element_by_xpath('//input[@id="search"]')
searchButton = driver.find_element_by_xpath('//button[@id="search-icon-legacy"]')