i我尝试在python中使用chromeoptions打开浏览器,但遇到了一些问题,我给出了可执行路径,但它也告诉了我。 Selenium Python的新手。需要帮助!
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
我的代码:
from selenium import webdriver
import unittest
from selenium.webdriver.chrome.options import Options
class Amazon(unittest.TestCase):
def setUp(self):
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-extensions")
self.driver = webdriver.Chrome(chrome_options=chrome_options,executable_path="F:\\chromedriver.exe")
def test_open_chrome(self):
self.driver.get("https://www.amazon.in/")
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
unittest.main()