Selenium WebDriver throws Timeout exceptions sporadically

前端 未结 8 1374
感情败类
感情败类 2020-12-01 07:43

Using selenium for ui tests on our project. We are running the newest version 2.30.0. We use Firefox WebDriver and are running Firefox 19.0.

Generally said the ui te

8条回答
  •  清歌不尽
    2020-12-01 07:54

    I had the same error with timing out. I was using the IEDriverServer (64bit) and on long sendKey commands it would timeout.

    The reason being is that the default timeout seems to be 60 seconds.

    What fixed my issue is that I instantiated the driver with a method that enables you to enter in the location of the IEDriverServer, the options for the driver AND the timeout value.

    Link to documentation : http://seleniumhq.github.io/selenium/docs/api/dotnet/

    public InternetExplorerDriver(
        string internetExplorerDriverServerDirectory,
        InternetExplorerOptions options,
        TimeSpan commandTimeout
    )
    

    Parameters

    1. InternetExplorerDriverServerDirectory:
      • Type : System.String
      • The full path to the directory containing IEDriverServer.exe
    2. options
      • Type : OpenQA.Selenium.IE.InternetExplorerOptions
      • The InternetExplorerOptions used to initialize the driver
    3. commandTimeout
      • Type : System.TimeSpan
      • The maximum amount of time to wait for each command

    My code

    InternetExplorerOptions options = new InternetExplorerOptions();
            IWebDriver driver = new InternetExplorerDriver("C:/Users/jeff/AppData/Local/Microsoft/WindowsApps", options, TimeSpan.FromSeconds(120));
    

提交回复
热议问题