Selenium Click () method in C # not returning - Chrome

I'm working on a Selenium app with Google Chrome that tries to click the Print button, but I get an exception when I try to click a link like this:

<a href="javascript:printDoc()">Print</a>

      

The app clicks on the link like this:

    var printOption = browser.FindElement(By.XPath("//*[@id='printLink']/div[1]/a"));
    printOption.Click();

      

The last statement throws the following error:

OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:65480/session/db0e763311af8fdd4f0ca06d79365d85/element timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out
   at System.Net.HttpWebRequest.GetResponse()
   at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
   --- End of inner exception stack trace ---
   at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
   at OpenQA.Selenium.By.FindElement(ISearchContext context)

      

Any advice or suggestions would be appreciated.

+3


source to share





All Articles