@@ -442,14 +442,14 @@ public void Dispose()
442442 /// variable, as if the function were called via "Function.apply"
443443 /// </para>
444444 /// </remarks>
445- public object ExecuteScript ( string script , params object ? [ ] args )
445+ public object ? ExecuteScript ( string script , params object ? [ ] args )
446446 {
447447 if ( this . WrappedDriver is not IJavaScriptExecutor javascriptDriver )
448448 {
449449 throw new NotSupportedException ( "Underlying driver instance does not support executing JavaScript" ) ;
450450 }
451451
452- object scriptResult ;
452+ object ? scriptResult ;
453453 try
454454 {
455455 object ? [ ] unwrappedArgs = UnwrapElementArguments ( args ) ;
@@ -505,7 +505,7 @@ public object ExecuteScript(string script, params object?[] args)
505505 /// variable, as if the function were called via "Function.apply"
506506 /// </para>
507507 /// </remarks>
508- public object ExecuteScript ( PinnedScript script , params object ? [ ] args )
508+ public object ? ExecuteScript ( PinnedScript script , params object ? [ ] args )
509509 {
510510 if ( script == null )
511511 {
@@ -517,7 +517,7 @@ public object ExecuteScript(PinnedScript script, params object?[] args)
517517 throw new NotSupportedException ( "Underlying driver instance does not support executing JavaScript" ) ;
518518 }
519519
520- object scriptResult ;
520+ object ? scriptResult ;
521521 try
522522 {
523523 object ? [ ] unwrappedArgs = UnwrapElementArguments ( args ) ;
@@ -542,14 +542,14 @@ public object ExecuteScript(PinnedScript script, params object?[] args)
542542 /// <param name="script">The JavaScript code to execute.</param>
543543 /// <param name="args">The arguments to the script.</param>
544544 /// <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 )
546546 {
547547 if ( this . WrappedDriver is not IJavaScriptExecutor javascriptDriver )
548548 {
549549 throw new NotSupportedException ( "Underlying driver instance does not support executing JavaScript" ) ;
550550 }
551551
552- object scriptResult ;
552+ object ? scriptResult ;
553553 try
554554 {
555555 object ? [ ] unwrappedArgs = UnwrapElementArguments ( args ) ;
@@ -1589,20 +1589,17 @@ public void Click()
15891589 /// </summary>
15901590 /// <param name="attributeName">Attribute you wish to get details of</param>
15911591 /// <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 )
15931593 {
1594- string attribute ;
15951594 try
15961595 {
1597- attribute = this . WrappedElement . GetAttribute ( attributeName ) ;
1596+ return this . WrappedElement . GetAttribute ( attributeName ) ;
15981597 }
15991598 catch ( Exception ex )
16001599 {
16011600 this . parentDriver . OnException ( new WebDriverExceptionEventArgs ( this . parentDriver , ex ) ) ;
16021601 throw ;
16031602 }
1604-
1605- return attribute ;
16061603 }
16071604
16081605 /// <summary>
@@ -1617,20 +1614,17 @@ public string GetAttribute(string attributeName)
16171614 /// of an IDL property of the element, either use the <see cref="GetAttribute(string)"/>
16181615 /// method or the <see cref="GetDomProperty(string)"/> method.
16191616 /// </remarks>
1620- public string GetDomAttribute ( string attributeName )
1617+ public string ? GetDomAttribute ( string attributeName )
16211618 {
1622- string attribute ;
16231619 try
16241620 {
1625- attribute = this . WrappedElement . GetDomAttribute ( attributeName ) ;
1621+ return this . WrappedElement . GetDomAttribute ( attributeName ) ;
16261622 }
16271623 catch ( Exception ex )
16281624 {
16291625 this . parentDriver . OnException ( new WebDriverExceptionEventArgs ( this . parentDriver , ex ) ) ;
16301626 throw ;
16311627 }
1632-
1633- return attribute ;
16341628 }
16351629
16361630 /// <summary>
@@ -1639,20 +1633,17 @@ public string GetDomAttribute(string attributeName)
16391633 /// <param name="propertyName">The name of the JavaScript property to get the value of.</param>
16401634 /// <returns>The JavaScript property's current value. Returns a <see langword="null"/> if the
16411635 /// value is not set or the property does not exist.</returns>
1642- public string GetDomProperty ( string propertyName )
1636+ public string ? GetDomProperty ( string propertyName )
16431637 {
1644- string elementProperty ;
16451638 try
16461639 {
1647- elementProperty = this . WrappedElement . GetDomProperty ( propertyName ) ;
1640+ return this . WrappedElement . GetDomProperty ( propertyName ) ;
16481641 }
16491642 catch ( Exception ex )
16501643 {
16511644 this . parentDriver . OnException ( new WebDriverExceptionEventArgs ( this . parentDriver , ex ) ) ;
16521645 throw ;
16531646 }
1654-
1655- return elementProperty ;
16561647 }
16571648
16581649 /// <summary>
@@ -1683,22 +1674,19 @@ public string GetCssValue(string propertyName)
16831674 /// <returns>A shadow root representation.</returns>
16841675 public ISearchContext GetShadowRoot ( )
16851676 {
1686- ISearchContext shadowRoot ;
16871677 try
16881678 {
16891679 GetShadowRootEventArgs e = new GetShadowRootEventArgs ( this . parentDriver . WrappedDriver , this . WrappedElement ) ;
16901680 this . parentDriver . OnGettingShadowRoot ( e ) ;
1691- shadowRoot = this . WrappedElement . GetShadowRoot ( ) ;
1681+ ISearchContext shadowRoot = this . WrappedElement . GetShadowRoot ( ) ;
16921682 this . parentDriver . OnGetShadowRootCompleted ( e ) ;
1693- shadowRoot = new EventFiringShadowRoot ( this . parentDriver , shadowRoot ) ;
1683+ return new EventFiringShadowRoot ( this . parentDriver , shadowRoot ) ;
16941684 }
16951685 catch ( Exception ex )
16961686 {
16971687 this . parentDriver . OnException ( new WebDriverExceptionEventArgs ( this . parentDriver , ex ) ) ;
16981688 throw ;
16991689 }
1700-
1701- return shadowRoot ;
17021690 }
17031691
17041692 /// <summary>
0 commit comments