Selenium.WebDriver - I get error when I try to run my test in Chrome

后端 未结 4 1840
暖寄归人
暖寄归人 2021-02-19 04:28

I get this error when I try to run my test in Chrome:

Initialization method AutomationUsingSelenium.SmuladorChrome.MyTestInitialize threw exception. OpenQ

4条回答
  •  孤城傲影
    2021-02-19 05:11

    Lets assume chromedriver.exe is present in below path: G:\Selenium_Csharp\Jar\chromedriver_win32\chromedriver.exe

    To execute your test in Chrome set the path to the directory/folder containing chromedriver.exe without selecting chromedriver.exe file name.

    driver = new ChromeDriver("G:\\Selenium_Csharp\\Jar\\chromedriver_win32");
    
    driver.Url ="http://www.gmail.com";
    driver.Manage().Window.Maximize();
    

    OR

    driver = new ChromeDriver(@"G:\Selenium_Csharp\\Jar\\chromedriver_win32");
    
    driver.Url ="http://www.gmail.com";
    driver.Manage().Window.Maximize();
    

提交回复
热议问题