From 414d5fdaf2046152d06d02736329c5d3482d3458 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Thu, 9 Dec 2021 23:57:29 +1100 Subject: [PATCH] RemoteWebDriver => WebDriver --- readme.md | 5 +++-- src/Directory.Build.props | 2 +- src/Tests/ModuleInitializer.cs | 1 + src/Tests/SeleniumFixture.cs | 4 ++-- src/Verify.Selenium/SeleniumExtensions.cs | 3 +-- src/Verify.Selenium/VerifySelenium.cs | 7 +++---- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/readme.md b/readme.md index 4f975e3..e66bf5b 100644 --- a/readme.md +++ b/readme.md @@ -29,8 +29,9 @@ Enable VerifyPlaywright once at assembly load time: ```cs VerifyPlaywright.Enable(); +Microsoft.Playwright.Program.Main(new[] {"install"}); ``` -snippet source | anchor +snippet source | anchor @@ -148,7 +149,7 @@ Enable VerifyPuppeteer once at assembly load time: ```cs VerifyPuppeteer.Enable(); ``` -snippet source | anchor +snippet source | anchor diff --git a/src/Directory.Build.props b/src/Directory.Build.props index e032a01..5df09df 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ CS1591;CS0649;CS8632 - 1.3.0 + 1.4.0 1.0.0 \ No newline at end of file diff --git a/src/Tests/ModuleInitializer.cs b/src/Tests/ModuleInitializer.cs index 7ac3702..bdfaf9f 100644 --- a/src/Tests/ModuleInitializer.cs +++ b/src/Tests/ModuleInitializer.cs @@ -15,6 +15,7 @@ public static class ModuleInitializer VerifyPlaywright.Enable(); Microsoft.Playwright.Program.Main(new[] {"install"}); + #endregion #region PuppeteerEnable diff --git a/src/Tests/SeleniumFixture.cs b/src/Tests/SeleniumFixture.cs index 4e16de4..6df4da5 100644 --- a/src/Tests/SeleniumFixture.cs +++ b/src/Tests/SeleniumFixture.cs @@ -23,8 +23,8 @@ public class SeleniumFixture : public Task DisposeAsync() { - Driver.Quit(); - Driver.Dispose(); + Driver?.Quit(); + Driver?.Dispose(); return Task.CompletedTask; } } \ No newline at end of file diff --git a/src/Verify.Selenium/SeleniumExtensions.cs b/src/Verify.Selenium/SeleniumExtensions.cs index 8007111..6d60c57 100644 --- a/src/Verify.Selenium/SeleniumExtensions.cs +++ b/src/Verify.Selenium/SeleniumExtensions.cs @@ -1,10 +1,9 @@ using OpenQA.Selenium; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; static class SeleniumExtensions { - public static void WaitForIsReady(this RemoteWebDriver driver) + public static void WaitForIsReady(this WebDriver driver) { WebDriverWait wait = new(driver, TimeSpan.FromSeconds(10)); wait.Until(_ => diff --git a/src/Verify.Selenium/VerifySelenium.cs b/src/Verify.Selenium/VerifySelenium.cs index 6daa20d..e12dfba 100644 --- a/src/Verify.Selenium/VerifySelenium.cs +++ b/src/Verify.Selenium/VerifySelenium.cs @@ -1,5 +1,4 @@ using OpenQA.Selenium; -using OpenQA.Selenium.Remote; namespace VerifyTests; @@ -7,14 +6,14 @@ public static class VerifySelenium { public static void Enable() { - VerifierSettings.RegisterFileConverter(DriverToImage); + VerifierSettings.RegisterFileConverter(DriverToImage); VerifierSettings.RegisterFileConverter(ElementToImage); } static ConversionResult ElementToImage(IWebElement target, IReadOnlyDictionary context) { var element = (WebElement)target; - var driver = (RemoteWebDriver)element.WrappedDriver; + var driver = (WebDriver)element.WrappedDriver; driver.WaitForIsReady(); var bytes = element.GetScreenshot().AsByteArray; return new( @@ -27,7 +26,7 @@ public static class VerifySelenium ); } - static ConversionResult DriverToImage(RemoteWebDriver driver, IReadOnlyDictionary context) + static ConversionResult DriverToImage(WebDriver driver, IReadOnlyDictionary context) { driver.WaitForIsReady(); var bytes = driver.GetScreenshot().AsByteArray;