代码之家  ›  专栏  ›  技术社区  ›  koushick

无法使用chromeoptions python打开浏览器[复制]

  •  0
  • koushick  · 技术社区  · 7 年前

    我尝试在python中使用chromeoptions来打开浏览器,但遇到了一些问题,我给出了可执行文件的路径,但它也像这样告诉我们新加入了硒的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()
    
    0 回复  |  直到 7 年前