 | ExtensionMethodsExecuteAsyncPromise Method |
Spustí asynchronní skript, který vrací promise. Skript je spuštěn v kontextu současného okna nebo framu.
Počká na doběhnutí promisu a vrátí jeho výsledek.
Namespace:
TescoSW.MW.UITests.Common
Assembly:
TescoSW.MW.UITests.Common (in TescoSW.MW.UITests.Common.dll) Version: 15.2.7099.36746
Syntaxpublic static Object ExecuteAsyncPromise(
this IJavaScriptExecutor executor,
string script,
params Object[] args
)
Parameters
- executor
- Type: IJavaScriptExecutor
Script executor - script
- Type: SystemString
The JavaScript code to execute. - args
- Type: SystemObject
The arguments to the script.
Return Value
Type:
ObjectThe value returned by the script.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IJavaScriptExecutor. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks
The ExecuteScript(String, Object)method executes JavaScript in the context of
the currently selected frame or window. This means that "document" will refer
to the current document. If the script has a return value, then the following
steps will be taken:
- For an HTML element, this method returns a IWebElement
- For a number, a Int64 is returned
- For a boolean, a Boolean is returned
- For all other cases a String is returned.
- For an array,we check the first element, and attempt to return a
ListT of that type, following the rules above. Nested lists are not
supported.
- If the value is null or there is no return value,
is returned.
Arguments must be a number (which will be converted to a Int64),
a Boolean, a String or a IWebElement.
An exception will be thrown if the arguments do not meet these criteria.
The arguments will be made available to the JavaScript via the "arguments" magic
variable, as if the function were called via "Function.apply"
See Also