Skip to content

Commit 9e38128

Browse files
committed
Use new Response not-null helper
1 parent 6ba0967 commit 9e38128

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

dotnet/src/webdriver/Firefox/FirefoxDriver.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,8 @@ public string InstallAddOn(string base64EncodedAddOn, bool temporary = false)
362362
["temporary"] = temporary
363363
};
364364
Response response = this.Execute(InstallAddOnCommand, parameters);
365-
if (response.Value is null)
366-
{
367-
throw new WebDriverException("Firefox add-on installation returned no add-on identifier");
368-
}
369365

370-
return (string)response.Value;
366+
return (string)response.Value!;
371367
}
372368

373369
/// <summary>
@@ -395,7 +391,8 @@ public Screenshot GetFullPageScreenshot()
395391
{
396392
Response screenshotResponse = this.Execute(GetFullPageScreenshotCommand, null);
397393

398-
string base64 = screenshotResponse.Value?.ToString() ?? throw new WebDriverException("GetFullPageScreenshotCommand returned successfully but contained no data");
394+
screenshotResponse.EnsureValueIsNotNull();
395+
string base64 = screenshotResponse.Value.ToString()!;
399396
return new Screenshot(base64);
400397
}
401398

0 commit comments

Comments
 (0)