@@ -1369,26 +1369,19 @@ private static string GetPromiseHandlerScript(string script, string javascriptBi
1369
1369
/// When false don't include a return statement e.g. 42;
1370
1370
/// </param>
1371
1371
/// <returns>
1372
- /// <see cref="Task{JavascriptResponse}"/> that can be awaited to perform the script execution.
1372
+ /// <see cref="Task{JavascriptResponse}"/> that can be awaited to obtain the result of the script execution.
1373
1373
/// </returns>
1374
- public static Task < JavascriptResponse > EvaluateScriptAsync ( this IWebBrowser browser , string script , TimeSpan ? timeout = null , bool useImmediatelyInvokedFuncExpression = false )
1374
+ public static Task < JavascriptResponse > EvaluateScriptAsync ( this IChromiumWebBrowserBase browser , string script , TimeSpan ? timeout = null , bool useImmediatelyInvokedFuncExpression = false )
1375
1375
{
1376
- if ( timeout . HasValue && timeout . Value . TotalMilliseconds > UInt32 . MaxValue )
1377
- {
1378
- throw new ArgumentOutOfRangeException ( "timeout" , "Timeout greater than Maximum allowable value of " + UInt32 . MaxValue ) ;
1379
- }
1380
-
1381
- if ( browser . CanExecuteJavascriptInMainFrame == false )
1376
+ if ( browser is IWebBrowser b )
1382
1377
{
1383
- ThrowExceptionIfCanExecuteJavascriptInMainFrameFalse ( ) ;
1378
+ if ( b . CanExecuteJavascriptInMainFrame == false )
1379
+ {
1380
+ ThrowExceptionIfCanExecuteJavascriptInMainFrameFalse ( ) ;
1381
+ }
1384
1382
}
1385
1383
1386
- using ( var frame = browser . GetMainFrame ( ) )
1387
- {
1388
- ThrowExceptionIfFrameNull ( frame ) ;
1389
-
1390
- return frame . EvaluateScriptAsync ( script , timeout : timeout , useImmediatelyInvokedFuncExpression : useImmediatelyInvokedFuncExpression ) ;
1391
- }
1384
+ return browser . BrowserCore . EvaluateScriptAsync ( script , timeout , useImmediatelyInvokedFuncExpression ) ;
1392
1385
}
1393
1386
1394
1387
/// <summary>
@@ -1404,7 +1397,7 @@ public static Task<JavascriptResponse> EvaluateScriptAsync(this IWebBrowser brow
1404
1397
/// When false don't include a return statement e.g. 42;
1405
1398
/// </param>
1406
1399
/// <returns>
1407
- /// <see cref="Task{JavascriptResponse}"/> that can be awaited to perform the script execution.
1400
+ /// <see cref="Task{JavascriptResponse}"/> that can be awaited to obtain the result of the script execution.
1408
1401
/// </returns>
1409
1402
public static Task < JavascriptResponse > EvaluateScriptAsync ( this IBrowser browser , string script , TimeSpan ? timeout = null , bool useImmediatelyInvokedFuncExpression = false )
1410
1403
{
@@ -1432,7 +1425,7 @@ public static Task<JavascriptResponse> EvaluateScriptAsync(this IBrowser browser
1432
1425
/// <param name="methodName">The javascript method name to execute.</param>
1433
1426
/// <param name="args">the arguments to be passed as params to the method.</param>
1434
1427
/// <returns>
1435
- /// <see cref="Task{JavascriptResponse}"/> that can be awaited to perform the script execution.
1428
+ /// <see cref="Task{JavascriptResponse}"/> that can be awaited to obtain the result of the script execution.
1436
1429
/// </returns>
1437
1430
public static Task < JavascriptResponse > EvaluateScriptAsync ( this IChromiumWebBrowserBase browser , string methodName , params object [ ] args )
1438
1431
{
0 commit comments