@@ -442,14 +442,14 @@ public void Dispose()
442
442
/// variable, as if the function were called via "Function.apply"
443
443
/// </para>
444
444
/// </remarks>
445
- public object ExecuteScript ( string script , params object ? [ ] args )
445
+ public object ? ExecuteScript ( string script , params object ? [ ] args )
446
446
{
447
447
if ( this . WrappedDriver is not IJavaScriptExecutor javascriptDriver )
448
448
{
449
449
throw new NotSupportedException ( "Underlying driver instance does not support executing JavaScript" ) ;
450
450
}
451
451
452
- object scriptResult ;
452
+ object ? scriptResult ;
453
453
try
454
454
{
455
455
object ? [ ] unwrappedArgs = UnwrapElementArguments ( args ) ;
@@ -505,7 +505,7 @@ public object ExecuteScript(string script, params object?[] args)
505
505
/// variable, as if the function were called via "Function.apply"
506
506
/// </para>
507
507
/// </remarks>
508
- public object ExecuteScript ( PinnedScript script , params object ? [ ] args )
508
+ public object ? ExecuteScript ( PinnedScript script , params object ? [ ] args )
509
509
{
510
510
if ( script == null )
511
511
{
@@ -517,7 +517,7 @@ public object ExecuteScript(PinnedScript script, params object?[] args)
517
517
throw new NotSupportedException ( "Underlying driver instance does not support executing JavaScript" ) ;
518
518
}
519
519
520
- object scriptResult ;
520
+ object ? scriptResult ;
521
521
try
522
522
{
523
523
object ? [ ] unwrappedArgs = UnwrapElementArguments ( args ) ;
@@ -542,14 +542,14 @@ public object ExecuteScript(PinnedScript script, params object?[] args)
542
542
/// <param name="script">The JavaScript code to execute.</param>
543
543
/// <param name="args">The arguments to the script.</param>
544
544
/// <returns>The value returned by the script.</returns>
545
- public object ExecuteAsyncScript ( string script , params object ? [ ] args )
545
+ public object ? ExecuteAsyncScript ( string script , params object ? [ ] args )
546
546
{
547
547
if ( this . WrappedDriver is not IJavaScriptExecutor javascriptDriver )
548
548
{
549
549
throw new NotSupportedException ( "Underlying driver instance does not support executing JavaScript" ) ;
550
550
}
551
551
552
- object scriptResult ;
552
+ object ? scriptResult ;
553
553
try
554
554
{
555
555
object ? [ ] unwrappedArgs = UnwrapElementArguments ( args ) ;
@@ -1589,20 +1589,17 @@ public void Click()
1589
1589
/// </summary>
1590
1590
/// <param name="attributeName">Attribute you wish to get details of</param>
1591
1591
/// <returns>The attribute's current value or null if the value is not set.</returns>
1592
- public string GetAttribute ( string attributeName )
1592
+ public string ? GetAttribute ( string attributeName )
1593
1593
{
1594
- string attribute ;
1595
1594
try
1596
1595
{
1597
- attribute = this . WrappedElement . GetAttribute ( attributeName ) ;
1596
+ return this . WrappedElement . GetAttribute ( attributeName ) ;
1598
1597
}
1599
1598
catch ( Exception ex )
1600
1599
{
1601
1600
this . parentDriver . OnException ( new WebDriverExceptionEventArgs ( this . parentDriver , ex ) ) ;
1602
1601
throw ;
1603
1602
}
1604
-
1605
- return attribute ;
1606
1603
}
1607
1604
1608
1605
/// <summary>
@@ -1617,20 +1614,17 @@ public string GetAttribute(string attributeName)
1617
1614
/// of an IDL property of the element, either use the <see cref="GetAttribute(string)"/>
1618
1615
/// method or the <see cref="GetDomProperty(string)"/> method.
1619
1616
/// </remarks>
1620
- public string GetDomAttribute ( string attributeName )
1617
+ public string ? GetDomAttribute ( string attributeName )
1621
1618
{
1622
- string attribute ;
1623
1619
try
1624
1620
{
1625
- attribute = this . WrappedElement . GetDomAttribute ( attributeName ) ;
1621
+ return this . WrappedElement . GetDomAttribute ( attributeName ) ;
1626
1622
}
1627
1623
catch ( Exception ex )
1628
1624
{
1629
1625
this . parentDriver . OnException ( new WebDriverExceptionEventArgs ( this . parentDriver , ex ) ) ;
1630
1626
throw ;
1631
1627
}
1632
-
1633
- return attribute ;
1634
1628
}
1635
1629
1636
1630
/// <summary>
@@ -1639,20 +1633,17 @@ public string GetDomAttribute(string attributeName)
1639
1633
/// <param name="propertyName">The name of the JavaScript property to get the value of.</param>
1640
1634
/// <returns>The JavaScript property's current value. Returns a <see langword="null"/> if the
1641
1635
/// value is not set or the property does not exist.</returns>
1642
- public string GetDomProperty ( string propertyName )
1636
+ public string ? GetDomProperty ( string propertyName )
1643
1637
{
1644
- string elementProperty ;
1645
1638
try
1646
1639
{
1647
- elementProperty = this . WrappedElement . GetDomProperty ( propertyName ) ;
1640
+ return this . WrappedElement . GetDomProperty ( propertyName ) ;
1648
1641
}
1649
1642
catch ( Exception ex )
1650
1643
{
1651
1644
this . parentDriver . OnException ( new WebDriverExceptionEventArgs ( this . parentDriver , ex ) ) ;
1652
1645
throw ;
1653
1646
}
1654
-
1655
- return elementProperty ;
1656
1647
}
1657
1648
1658
1649
/// <summary>
@@ -1683,22 +1674,19 @@ public string GetCssValue(string propertyName)
1683
1674
/// <returns>A shadow root representation.</returns>
1684
1675
public ISearchContext GetShadowRoot ( )
1685
1676
{
1686
- ISearchContext shadowRoot ;
1687
1677
try
1688
1678
{
1689
1679
GetShadowRootEventArgs e = new GetShadowRootEventArgs ( this . parentDriver . WrappedDriver , this . WrappedElement ) ;
1690
1680
this . parentDriver . OnGettingShadowRoot ( e ) ;
1691
- shadowRoot = this . WrappedElement . GetShadowRoot ( ) ;
1681
+ ISearchContext shadowRoot = this . WrappedElement . GetShadowRoot ( ) ;
1692
1682
this . parentDriver . OnGetShadowRootCompleted ( e ) ;
1693
- shadowRoot = new EventFiringShadowRoot ( this . parentDriver , shadowRoot ) ;
1683
+ return new EventFiringShadowRoot ( this . parentDriver , shadowRoot ) ;
1694
1684
}
1695
1685
catch ( Exception ex )
1696
1686
{
1697
1687
this . parentDriver . OnException ( new WebDriverExceptionEventArgs ( this . parentDriver , ex ) ) ;
1698
1688
throw ;
1699
1689
}
1700
-
1701
- return shadowRoot ;
1702
1690
}
1703
1691
1704
1692
/// <summary>
0 commit comments