MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / Timeouts

Class Timeouts

dotnet/src/webdriver/Timeouts.cs:27–146  ·  view source on GitHub ↗

Defines the interface through which the user can define timeouts.

Source from the content-addressed store, hash-verified

25/// Defines the interface through which the user can define timeouts.
26/// </summary>
27internal class Timeouts : ITimeouts
28{
29 private const string ImplicitTimeoutName = "implicit";
30 private const string AsyncScriptTimeoutName = "script";
31 private const string PageLoadTimeoutName = "pageLoad";
32 private const string LegacyPageLoadTimeoutName = "page load";
33
34 private static readonly TimeSpan DefaultImplicitWaitTimeout = TimeSpan.FromSeconds(0);
35 private static readonly TimeSpan DefaultAsyncScriptTimeout = TimeSpan.FromSeconds(30);
36 private static readonly TimeSpan DefaultPageLoadTimeout = TimeSpan.FromSeconds(300);
37
38 private readonly WebDriver driver;
39
40 /// <summary>
41 /// Initializes a new instance of the <see cref="Timeouts"/> class
42 /// </summary>
43 /// <param name="driver">The driver that is currently in use</param>
44 public Timeouts(WebDriver driver)
45 {
46 ArgumentNullException.ThrowIfNull(driver);
47 this.driver = driver;
48 }
49
50 /// <summary>
51 /// Gets or sets the implicit wait timeout, which is the amount of time the
52 /// driver should wait when searching for an element if it is not immediately
53 /// present.
54 /// </summary>
55 /// <remarks>
56 /// When searching for a single element, the driver should poll the page
57 /// until the element has been found, or this timeout expires before throwing
58 /// a <see cref="NoSuchElementException"/>. When searching for multiple elements,
59 /// the driver should poll the page until at least one element has been found
60 /// or this timeout has expired.
61 /// <para>
62 /// Increasing the implicit wait timeout should be used judiciously as it
63 /// will have an adverse effect on test run time, especially when used with
64 /// slower location strategies like XPath.
65 /// </para>
66 /// <para>
67 /// Also can be managed via driver <see cref="DriverOptions.ImplicitWaitTimeout"/> option.
68 /// </para>
69 /// </remarks>
70 public TimeSpan ImplicitWait
71 {
72 get => this.ExecuteGetTimeout(ImplicitTimeoutName);
73 set => this.ExecuteSetTimeout(ImplicitTimeoutName, value);
74 }
75
76 /// <summary>
77 /// Gets or sets the asynchronous script timeout, which is the amount
78 /// of time the driver should wait when executing JavaScript asynchronously.
79 /// This timeout only affects the <see cref="IJavaScriptExecutor.ExecuteAsyncScript(string, object[])"/>
80 /// method.
81 /// </summary>
82 /// <remarks>
83 /// <para>
84 /// Also can be managed via driver <see cref="DriverOptions.ScriptTimeout"/> option.

Callers

nothing calls this directly

Calls 2

ExecuteGetTimeoutMethod · 0.95
ExecuteSetTimeoutMethod · 0.95

Tested by

no test coverage detected