Selenium webdriver

Hello,

How do I use Selenium webdriver with Linqpad? chromedriver.exe islocated the same folder as the script. When I run the code it generates the followin exception.

Exception:

DriverServiceNotFoundException: The chromedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html.

Code:

var path = Path.GetDirectoryName(Util.CurrentQueryPath);
var driverBinary = $"{path}\\chromedriver.exe";
System.Environment.SetEnvironmentVariable("webdriver.chrome.driver",
driverBinary);
IWebDriver browser = new ChromeDriver();

This code works well in VS.

Comments

  • The question is closed. Correct code is

    var path = Path.GetDirectoryName(Util.CurrentQueryPath);
    IWebDriver browser = new ChromeDriver(path);
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!