How to specify the location of the chromedriver binary

前端 未结 3 1849
时光取名叫无心
时光取名叫无心 2020-12-16 17:38

Earlier I had put the Chrome binary, \"chromedriver.exe\", in the \"C:/Windows\" directory and Watir was picking it from there. Now I have to move my project to another mach

3条回答
  •  既然无缘
    2020-12-16 18:14

    Update your Selenium driver_path directly.

    Just call this before launching your new Chrome browser window:

    Selenium::WebDriver::Chrome::Service.driver_path = Rails.root.join( "lib", "chromedriver" ).to_s
    

    Of course, change the path to where your chromedriver is.

    NOTE: driver_path needs to be a String, so don't pass in a File or Path object.

提交回复
热议问题