简体   繁体   中英

Coypu freezing application

I'm trying a very simple code using Coypu but my app just freezes without any exceptions.

I've setup a new C# project and installed Coypu using nuget, the application bin folder seems to contain all the necessary files as well:

  • chromedriver.exe ( downloaded )
  • Coypu.dll
  • WebDriver.dll
  • WebDriver.Support.dll.

Sample:

var sessionConfiguration = new SessionConfiguration
{
  Driver = typeof(SeleniumWebDriver),
  Browser = Coypu.Drivers.Browser.Chrome
};

using (var browser = new BrowserSession())//Freezes here
{
  browser.Visit("http://www.google.com");//Never reaches
}

MessageBox.Show("Done");//Never reaches

Pass the sessionConfiguration object to your BrowserSession.

var sessionConfiguration = new SessionConfiguration
{
  Driver = typeof(SeleniumWebDriver),
  Browser = Coypu.Drivers.Browser.Chrome
};

using (var browser = new BrowserSession(sessionConfiguration))
{
  browser.Visit("http://www.google.com");
}

MessageBox.Show("Done");

This works:

var browser = new BrowserSession(new SessionConfiguration()
{
   Driver = typeof(SeleniumWebDriver),
   Browser = Coypu.Drivers.Browser.Chrome
});

browser.Visit("http://www.google.com");
browser.FillIn("lst-ib").With("hakuna matata");
browser.ClickButton("btnG");            

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM