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

Method Invoke

dotnet/src/support/UI/PopupWindowFinder.cs:123–140  ·  view source on GitHub ↗

Invokes a method that is expected to trigger a popup browser window. An that, when run, invokes the popup browser window. The window handle of the popup browser window. Thrown if no popup window appears within the specified timeout. <exception cref=

(Action popupMethod)

Source from the content-addressed store, hash-verified

121 /// <exception cref="WebDriverTimeoutException">Thrown if no popup window appears within the specified timeout.</exception>
122 /// <exception cref="ArgumentNullException">Thrown if the action to invoke is <see langword="null"/>.</exception>
123 public string Invoke(Action popupMethod)
124 {
125 if (popupMethod is null)
126 {
127 throw new ArgumentNullException(nameof(popupMethod), "popupMethod cannot be null");
128 }
129
130 ReadOnlyCollection<string> existingHandles = this.driver.WindowHandles;
131 popupMethod();
132 WebDriverWait wait = new WebDriverWait(SystemClock.Instance, this.driver, this.timeout, this.sleepInterval);
133 string popupHandle = wait.Until(driver =>
134 {
135 ReadOnlyCollection<string> newHandles = driver.WindowHandles;
136 return newHandles.Except(existingHandles, StringComparer.Ordinal).FirstOrDefault();
137 });
138
139 return popupHandle;
140 }
141}

Callers 15

ClickMethod · 0.95
ExecuteToJsonMethodMethod · 0.80
GetArrayItemMethod · 0.80
GetPropertyValueMethod · 0.80
AcceptFileSelectionMethod · 0.80
EscapeQuotesMethod · 0.80
OnAuthRequiredMethod · 0.80

Calls 1

UntilMethod · 0.45

Tested by 2

EscapeQuotesMethod · 0.64