diff --git a/CHANGELOG.md b/CHANGELOG.md index b894953..2ae488a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ ## 1.0.0-alpha1x (to be released on 2021.05.??) - deprecate the majority of Selene.* (except S, SS) when providing alternative API via Browser.* +## 1.0.0-alpha10 (to be released on 2022.05.27) +- upgraded Selenium.WebDriver from 3.141.0 to 4.2.0 + - kept old-fashioned names for SeleneElement.GetAttribute & .GetProperty + but now under the hood they use new GetDomAttribute & GetDomProperty correspondingly + - added SeleneElement.GetShadowRoot as wrapper over WebElement.GetShadowRoot + ## 1.0.0-alpha09 (to be released on 2021.05.19) - improved error messages for cases of inner element search - like error on S(".parent").Find(".child").Click() when .parent is absent or not visible diff --git a/NSelene/NSelene.csproj b/NSelene/NSelene.csproj index c55dcb0..37c3b8f 100644 --- a/NSelene/NSelene.csproj +++ b/NSelene/NSelene.csproj @@ -3,7 +3,7 @@ netstandard2.0 NSelene - 1.0.0-alpha09 + 1.0.0-alpha10 yashaka MIT Copyright (c) 2015-2021 Iakiv Kramarenko @@ -33,7 +33,7 @@ - + diff --git a/NSelene/SeleneElement.cs b/NSelene/SeleneElement.cs index 6ac68af..1ad763c 100644 --- a/NSelene/SeleneElement.cs +++ b/NSelene/SeleneElement.cs @@ -683,6 +683,11 @@ public bool Displayed // // IWebElement Methods + // + // TODO: do we really need these explicit interface implemantations? why? + // we might need only GetDomAttribute and GetDomProperty + // because we want to hide them from SeleneElement public API... + // so more lacontic versions (GetAttribute, GetProperty) can be used // void IWebElement.Clear() @@ -705,16 +710,32 @@ void IWebElement.Click() Click(); } + string IWebElement.GetDomAttribute(string attributeName) + { + return this.ActualWebElement.GetDomAttribute(attributeName); + } + + string IWebElement.GetDomProperty(string propertyName) + { + return this.ActualWebElement.GetDomProperty(propertyName); + } + public string GetAttribute(string name) { Should(Be.InDom); - return this.ActualWebElement.GetAttribute(name); + return this.ActualWebElement.GetDomAttribute(name); } public string GetProperty (string propertyName) { Should(Be.InDom); - return this.ActualWebElement.GetProperty(propertyName); + return this.ActualWebElement.GetDomProperty(propertyName); + } + + public ISearchContext GetShadowRoot () + { + Should(Be.InDom); + return this.ActualWebElement.GetShadowRoot(); } public string GetCssValue(string property) diff --git a/NSeleneTests/Examples/SharedDriver/Straightforward/TodoMvc_Should.cs b/NSeleneTests/Examples/SharedDriver/Straightforward/TodoMvc_Should.cs index 9da59b4..50b0156 100644 --- a/NSeleneTests/Examples/SharedDriver/Straightforward/TodoMvc_Should.cs +++ b/NSeleneTests/Examples/SharedDriver/Straightforward/TodoMvc_Should.cs @@ -13,8 +13,8 @@ public class BrowserTest public void initDriver() { new DriverManager().SetUpDriver( - // new ChromeConfig(), version: "Latest" - new ChromeConfig(), version: "89.0.4389.23" + new ChromeConfig(), version: "Latest" + // new ChromeConfig(), version: "89.0.4389.23" ); var options = new ChromeOptions(); options.AddArguments("headless"); diff --git a/NSeleneTests/Examples/SharedDriver/WithPageObjects/TodoMvc_Should.cs b/NSeleneTests/Examples/SharedDriver/WithPageObjects/TodoMvc_Should.cs index ddf3eaa..e287637 100644 --- a/NSeleneTests/Examples/SharedDriver/WithPageObjects/TodoMvc_Should.cs +++ b/NSeleneTests/Examples/SharedDriver/WithPageObjects/TodoMvc_Should.cs @@ -13,8 +13,8 @@ public class BrowserTest public void initDriver() { new DriverManager().SetUpDriver( - // new ChromeConfig(), version: "Latest" - new ChromeConfig(), version: "89.0.4389.23" + new ChromeConfig(), version: "Latest" + // new ChromeConfig(), version: "89.0.4389.23" ); var options = new ChromeOptions(); options.AddArguments("headless"); diff --git a/NSeleneTests/Integration/SharedDriver/Configuration_Specs.cs b/NSeleneTests/Integration/SharedDriver/Configuration_Specs.cs index 43f6f02..bd4c6e8 100644 --- a/NSeleneTests/Integration/SharedDriver/Configuration_Specs.cs +++ b/NSeleneTests/Integration/SharedDriver/Configuration_Specs.cs @@ -17,8 +17,8 @@ public class Configuration_Specs public void InitConfiguration() { new DriverManager().SetUpDriver( - // new ChromeConfig(), version: "Latest" - new ChromeConfig(), version: "89.0.4389.23" + new ChromeConfig(), version: "Latest" + // new ChromeConfig(), version: "89.0.4389.23" ); var options = new ChromeOptions(); diff --git a/NSeleneTests/Integration/SharedDriver/SeleneElement_Clear_Specs.cs b/NSeleneTests/Integration/SharedDriver/SeleneElement_Clear_Specs.cs index 539bbf3..8eb46f8 100644 --- a/NSeleneTests/Integration/SharedDriver/SeleneElement_Clear_Specs.cs +++ b/NSeleneTests/Integration/SharedDriver/SeleneElement_Clear_Specs.cs @@ -36,7 +36,7 @@ public void Clear_WaitsForVisibility_OfInitiialyAbsent() Assert.AreEqual( "", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); Assert.Greater(afterCall, beforeCall.AddSeconds(0.3)); Assert.Less(afterCall, beforeCall.AddSeconds(0.6)); @@ -125,7 +125,7 @@ public void Clear_IsRenderedInError_OnAbsentElementFailure_WhenCustomizedToWaitF // Assert.AreEqual( // "", // Configuration.Driver - // .FindElement(By.TagName("input")).GetProperty("value") + // .FindElement(By.TagName("input")).GetDomProperty("value") // ); // } @@ -158,7 +158,7 @@ public void Clear_WaitsForVisibility_OfInitialyHidden() Assert.AreEqual( "", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); Assert.Greater(afterCall, beforeCall.AddSeconds(0.3)); Assert.Less(afterCall, beforeCall.AddSeconds(0.6)); @@ -199,7 +199,7 @@ public void Clear_IsRenderedInError_OnHiddenElementFailure() Assert.AreEqual( "abracadabra", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -239,7 +239,7 @@ public void Clear_IsRenderedInError_OnHiddenElementFailure_WhenCustomizedToWaitF Assert.AreEqual( "abracadabra", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -287,7 +287,7 @@ public void Clear_WorksUnderOverlay_ByDefault() Assert.AreEqual( "", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } @@ -341,7 +341,7 @@ public void Clear_Waits_For_NoOverlay_WhenCustomized() Assert.AreEqual( "", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } diff --git a/NSeleneTests/Integration/SharedDriver/SeleneElement_DoubleClick_Specs.cs b/NSeleneTests/Integration/SharedDriver/SeleneElement_DoubleClick_Specs.cs index 2dd4a74..13d7707 100644 --- a/NSeleneTests/Integration/SharedDriver/SeleneElement_DoubleClick_Specs.cs +++ b/NSeleneTests/Integration/SharedDriver/SeleneElement_DoubleClick_Specs.cs @@ -24,7 +24,7 @@ public void DoubleClick_WaitsForVisibility_OfInitiialyAbsent() to h2

Heading 2

", - 300 + 250 ); S("span").DoubleClick(); diff --git a/NSeleneTests/Integration/SharedDriver/SeleneElement_SendKeys_Specs.cs b/NSeleneTests/Integration/SharedDriver/SeleneElement_SendKeys_Specs.cs index 90e82d2..cfc1d30 100644 --- a/NSeleneTests/Integration/SharedDriver/SeleneElement_SendKeys_Specs.cs +++ b/NSeleneTests/Integration/SharedDriver/SeleneElement_SendKeys_Specs.cs @@ -39,7 +39,7 @@ public void SendKeys_WaitsForVisibility_OfInitiialyAbsent() Assert.AreEqual( "before and after", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); Assert.Greater(afterCall, beforeCall.AddSeconds(0.3)); Assert.Less(afterCall, beforeCall.AddSeconds(0.7)); @@ -102,7 +102,7 @@ public void SendKeys_PassesOnHiddenInputOfTypeFile() StringAssert.Contains( "empty.html", Configuration.Driver - .FindElement(By.CssSelector("[type=file]")).GetProperty("value") + .FindElement(By.CssSelector("[type=file]")).GetDomProperty("value") ); } @@ -135,7 +135,7 @@ public void SendKeys_WaitsForVisibility_OfInitialyHidden() Assert.AreEqual( "before and after", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); Assert.Greater(afterCall, beforeCall.AddSeconds(0.3)); Assert.Less(afterCall, beforeCall.AddSeconds(0.7)); @@ -176,7 +176,7 @@ public void SendKeys_IsRenderedInError_OnHiddenElementFailure() Assert.AreEqual( "before ", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -230,7 +230,7 @@ public void SendKeys_IsRenderedInError_OnHiddenElementFailure() Assert.AreEqual( "before and after", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } diff --git a/NSeleneTests/Integration/SharedDriver/SeleneElement_SetValue_Specs.cs b/NSeleneTests/Integration/SharedDriver/SeleneElement_SetValue_Specs.cs index b5fd394..4402914 100644 --- a/NSeleneTests/Integration/SharedDriver/SeleneElement_SetValue_Specs.cs +++ b/NSeleneTests/Integration/SharedDriver/SeleneElement_SetValue_Specs.cs @@ -39,7 +39,7 @@ public void SetValue_WaitsForVisibility_OfInitiialyAbsent() Assert.AreEqual( "overwritten", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); Assert.Greater(afterCall, beforeCall.AddSeconds(0.3)); Assert.Less(afterCall, beforeCall.AddSeconds(0.6)); @@ -147,7 +147,7 @@ public void SetValue_IsRenderedInError_OnAbsentElementFailure_WhenCustomizedToWa Assert.AreEqual( "", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -192,7 +192,7 @@ public void SetValue_IsRenderedInError_OnAbsentElementFailure_WhenCustomizedToWa Assert.AreEqual( "", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -226,7 +226,7 @@ public void SetValue_WaitsForVisibility_OfInitialyHidden() Assert.AreEqual( "overwritten", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); Assert.Greater(afterCall, beforeCall.AddSeconds(0.3)); Assert.Less(afterCall, beforeCall.AddSeconds(0.6)); @@ -267,7 +267,7 @@ public void SetValue_IsRenderedInError_OnHiddenElementFailure() Assert.AreEqual( "initial", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -307,7 +307,7 @@ public void SetValue_IsRenderedInError_OnHiddenElementFailure_WhenCustomizedToWa Assert.AreEqual( "initial", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -355,7 +355,7 @@ public void SetValue_WorksUnderOverlay_ByDefault() Assert.AreEqual( "overwritten", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } @@ -409,7 +409,7 @@ public void SetValue_WaitsForNoOverlay_WhenCustomized() Assert.AreEqual( "overwritten", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } diff --git a/NSeleneTests/Integration/SharedDriver/SeleneElement_Submit_Specs.cs b/NSeleneTests/Integration/SharedDriver/SeleneElement_Submit_Specs.cs index 589d8b8..3dcd5f2 100644 --- a/NSeleneTests/Integration/SharedDriver/SeleneElement_Submit_Specs.cs +++ b/NSeleneTests/Integration/SharedDriver/SeleneElement_Submit_Specs.cs @@ -344,9 +344,7 @@ public void Submit_Fails_OnNonFormElement() Assert.Contains("Reason:", lines); Assert.Contains( - "no such element: Unable to locate element: " - + "{\"method\":\"xpath\",\"selector\":\"./ancestor-or-self::form\"}" - , + "javascript error: Unable to find owning document", lines ); diff --git a/NSeleneTests/Integration/SharedDriver/SeleneElement_Type_Specs.cs b/NSeleneTests/Integration/SharedDriver/SeleneElement_Type_Specs.cs index 97195ee..f3308d7 100644 --- a/NSeleneTests/Integration/SharedDriver/SeleneElement_Type_Specs.cs +++ b/NSeleneTests/Integration/SharedDriver/SeleneElement_Type_Specs.cs @@ -41,7 +41,7 @@ public void Type_WaitsForVisibility_OfInitiialyAbsent() Assert.AreEqual( "before and after", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); Assert.Greater(afterCall, beforeCall.AddSeconds(0.3)); Assert.Less(afterCall, beforeCall.AddSeconds(0.7)); @@ -118,7 +118,7 @@ public void Type_FailsOnHiddenInputOfTypeFile() Assert.AreEqual( "", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -152,7 +152,7 @@ public void Type_WaitsForVisibility_OfInitialyHidden() Assert.AreEqual( "before and after", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); Assert.Greater(afterCall, beforeCall.AddSeconds(0.3)); Assert.Less(afterCall, beforeCall.AddSeconds(0.7)); @@ -193,7 +193,7 @@ public void Type_IsRenderedInError_OnHiddenElementFailure() Assert.AreEqual( "before ", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -232,7 +232,7 @@ public void Type_IsRenderedInError_OnHiddenElementFailure_WhenCustomizedToWaitFo Assert.AreEqual( "before ", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } } @@ -280,7 +280,7 @@ public void Type_WorksUnderOverlay_ByDefault() Assert.AreEqual( "before and after", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } @@ -334,7 +334,7 @@ public void Type_WaitsForNoOverlay_IfExplicitelyCustomized() Assert.AreEqual( "before and after", Configuration.Driver - .FindElement(By.TagName("input")).GetProperty("value") + .FindElement(By.TagName("input")).GetDomProperty("value") ); } diff --git a/NSeleneTests/NSeleneTests.csproj b/NSeleneTests/NSeleneTests.csproj index 0de5071..b75036b 100644 --- a/NSeleneTests/NSeleneTests.csproj +++ b/NSeleneTests/NSeleneTests.csproj @@ -11,7 +11,7 @@ - + diff --git a/README.md b/README.md index 209ad99..9435af3 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,10 @@ For docs see tests in the [NSeleneTests](https://github.com/yashaka/NSelene/blob ## Versions -* Upcomig version to use is just released [1.0.0-alpha09](https://www.nuget.org/packages/NSelene/1.0.0-alpha09) +* Upcomig version to use is just released [1.0.0-alpha10](https://www.nuget.org/packages/NSelene/1.0.0-alpha10) * targets netstandard2.0 * net45 support may be added later + * wraps Selenium 4.2.0 * it differs from [0.0.0.7](https://www.nuget.org/packages/NSelene/0.0.0.7) in the following: * repacked in sdk-style format * removed things marked as obsolete til 0.0.0.7 @@ -302,9 +303,7 @@ Before doing anything it's good to just clone the project via `git clone https:/ - the readme is updated if needed - tests pass ``` - cd NSeleneTests dotnet test - cd ../NSelene ``` - the corresponding git tag with current version number and description (should reflect the changelog) is added