From 3f8cae8f813830aa1d4acf2b5472c193cbb09c19 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 14:52:42 +0300 Subject: [PATCH 01/35] Get attribute value --- .../common/BiDi/Input/DefaultKeyboardTest.cs | 4 +- dotnet/test/common/ClearTest.cs | 8 +- dotnet/test/common/CorrectEventFiringTest.cs | 2 +- dotnet/test/common/ElementAttributeTest.cs | 14 +-- dotnet/test/common/ElementFindingTest.cs | 20 ++--- .../common/ExecutingAsyncJavascriptTest.cs | 4 +- dotnet/test/common/FormHandlingTests.cs | 38 ++++---- dotnet/test/common/FrameSwitchingTest.cs | 8 +- dotnet/test/common/I18Test.cs | 6 +- .../BasicKeyboardInterfaceTest.cs | 18 ++-- .../Interactions/BasicMouseInterfaceTest.cs | 6 +- .../Interactions/CombinedInputActionsTest.cs | 6 +- .../common/JavascriptEnabledBrowserTest.cs | 4 +- .../test/common/SelectElementHandlingTest.cs | 6 +- dotnet/test/common/TextHandlingTest.cs | 6 +- dotnet/test/common/TypingTest.cs | 86 +++++++++---------- dotnet/test/common/UploadTest.cs | 2 +- dotnet/test/common/VisibilityTest.cs | 2 +- dotnet/test/common/WebElementTest.cs | 6 +- dotnet/test/firefox/FirefoxDriverTest.cs | 10 +-- 20 files changed, 128 insertions(+), 128 deletions(-) diff --git a/dotnet/test/common/BiDi/Input/DefaultKeyboardTest.cs b/dotnet/test/common/BiDi/Input/DefaultKeyboardTest.cs index f6611d1416063..865bab74828d1 100644 --- a/dotnet/test/common/BiDi/Input/DefaultKeyboardTest.cs +++ b/dotnet/test/common/BiDi/Input/DefaultKeyboardTest.cs @@ -34,7 +34,7 @@ // .PointerUp(0) // .Type("abc def")); -// Assert.That(driver.FindElement(By.Id("textInput")).GetAttribute("value"), Is.EqualTo("abc def")); +// Assert.That(driver.FindElement(By.Id("textInput")).GetDomProperty("value"), Is.EqualTo("abc def")); // } // [Test] @@ -86,7 +86,7 @@ // .KeyUp(Key.Shift)); // Assert.That(driver.FindElement(By.Id("result")).Text, Does.EndWith("keydown keydown keypress keyup keydown keypress keyup keyup")); -// Assert.That(driver.FindElement(By.Id("theworks")).GetAttribute("value"), Is.EqualTo("AB")); +// Assert.That(driver.FindElement(By.Id("theworks")).GetDomProperty("value"), Is.EqualTo("AB")); // } // [Test] diff --git a/dotnet/test/common/ClearTest.cs b/dotnet/test/common/ClearTest.cs index d65a7f7e7a00a..6cef4fc577085 100644 --- a/dotnet/test/common/ClearTest.cs +++ b/dotnet/test/common/ClearTest.cs @@ -31,7 +31,7 @@ public void WritableTextInputShouldClear() driver.Url = readOnlyPage; IWebElement element = driver.FindElement(By.Id("writableTextInput")); element.Clear(); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); } [Test] @@ -63,7 +63,7 @@ public void WritableTextAreaShouldClear() driver.Url = readOnlyPage; IWebElement element = driver.FindElement(By.Id("writableTextArea")); element.Clear(); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); } [Test] @@ -202,10 +202,10 @@ private void ShouldBeAbleToClearInput(By locator, string oldValue, string cleare { driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("inputs.html"); IWebElement element = driver.FindElement(locator); - Assert.That(element.GetAttribute("value"), Is.EqualTo(oldValue)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(oldValue)); element.Clear(); - Assert.That(element.GetAttribute("value"), Is.EqualTo(clearedValue)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(clearedValue)); } } } diff --git a/dotnet/test/common/CorrectEventFiringTest.cs b/dotnet/test/common/CorrectEventFiringTest.cs index 6e1da8e0313bd..a81d370734ba7 100644 --- a/dotnet/test/common/CorrectEventFiringTest.cs +++ b/dotnet/test/common/CorrectEventFiringTest.cs @@ -245,7 +245,7 @@ public void ShouldEmitClickEventWhenClickingOnATextInputElement() IWebElement clicker = driver.FindElement(By.Id("clickField")); clicker.Click(); - Assert.That(clicker.GetAttribute("value"), Is.EqualTo("Clicked")); + Assert.That(clicker.GetDomProperty("value"), Is.EqualTo("Clicked")); } [Test] diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 9eb59cfff2f5a..c620477d1ac72 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -222,7 +222,7 @@ public void ShouldReturnTheContentsOfATextAreaAsItsValue() { driver.Url = formsPage; - String value = driver.FindElement(By.Id("withText")).GetAttribute("value"); + String value = driver.FindElement(By.Id("withText")).GetDomProperty("value"); Assert.That(value, Is.EqualTo("Example text")); } @@ -333,9 +333,9 @@ public void CanRetrieveTheCurrentValueOfATextFormField_textInput() { driver.Url = formsPage; IWebElement element = driver.FindElement(By.Id("working")); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); element.SendKeys("hello world"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("hello world")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("hello world")); } [Test] @@ -343,9 +343,9 @@ public void CanRetrieveTheCurrentValueOfATextFormField_emailInput() { driver.Url = formsPage; IWebElement element = driver.FindElement(By.Id("email")); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); element.SendKeys("hello world"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("hello world")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("hello world")); } [Test] @@ -353,9 +353,9 @@ public void CanRetrieveTheCurrentValueOfATextFormField_textArea() { driver.Url = formsPage; IWebElement element = driver.FindElement(By.Id("emptyTextArea")); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); element.SendKeys("hello world"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("hello world")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("hello world")); } [Test] diff --git a/dotnet/test/common/ElementFindingTest.cs b/dotnet/test/common/ElementFindingTest.cs index f1375531be5f3..df26a0bf6259a 100644 --- a/dotnet/test/common/ElementFindingTest.cs +++ b/dotnet/test/common/ElementFindingTest.cs @@ -135,7 +135,7 @@ public void ShouldBeAbleToFindASingleElementByName() { driver.Url = formsPage; IWebElement element = driver.FindElement(By.Name("checky")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("furrfu")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("furrfu")); } [Test] @@ -417,7 +417,7 @@ public void ShouldBeAbleToFindAnElementByXPathWithMultipleAttributes() IWebElement element = driver.FindElement( By.XPath("//form[@name='optional']/input[@type='submit' and @value='Click!']")); Assert.That(element.TagName.ToLower(), Is.EqualTo("input")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("Click!")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("Click!")); } [Test] @@ -594,7 +594,7 @@ public void ShouldBeAbleToFindAnElementByBooleanAttributeUsingCssSelector() { driver.Url = (EnvironmentManager.Instance.UrlBuilder.WhereIs("locators_tests/boolean_attribute_selected.html")); IWebElement element = driver.FindElement(By.CssSelector("option[selected='selected']")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("two")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("two")); } [Test] @@ -602,7 +602,7 @@ public void ShouldBeAbleToFindAnElementByBooleanAttributeUsingShortCssSelector() { driver.Url = (EnvironmentManager.Instance.UrlBuilder.WhereIs("locators_tests/boolean_attribute_selected.html")); IWebElement element = driver.FindElement(By.CssSelector("option[selected]")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("two")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("two")); } [Test] @@ -610,7 +610,7 @@ public void ShouldBeAbleToFindAnElementByBooleanAttributeUsingShortCssSelectorOn { driver.Url = (EnvironmentManager.Instance.UrlBuilder.WhereIs("locators_tests/boolean_attribute_selected_html4.html")); IWebElement element = driver.FindElement(By.CssSelector("option[selected]")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("two")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("two")); } // By.CssSelector negative @@ -798,16 +798,16 @@ public void WhenFindingByNameShouldNotReturnById() driver.Url = formsPage; IWebElement element = driver.FindElement(By.Name("id-name1")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("name")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("name")); element = driver.FindElement(By.Id("id-name1")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("id")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("id")); element = driver.FindElement(By.Name("id-name2")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("name")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("name")); element = driver.FindElement(By.Id("id-name2")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("id")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("id")); } [Test] @@ -912,7 +912,7 @@ public void ShouldFindElementsByName() IWebElement element = driver.FindElement(By.Name("checky")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("furrfu")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("furrfu")); } [Test] diff --git a/dotnet/test/common/ExecutingAsyncJavascriptTest.cs b/dotnet/test/common/ExecutingAsyncJavascriptTest.cs index ef0711453b6dc..0b8f404570ff2 100644 --- a/dotnet/test/common/ExecutingAsyncJavascriptTest.cs +++ b/dotnet/test/common/ExecutingAsyncJavascriptTest.cs @@ -238,7 +238,7 @@ public void ShouldBeAbleToExecuteAsynchronousScripts() IWebElement typer = driver.FindElement(By.Name("typer")); typer.SendKeys("bob"); - Assert.That(typer.GetAttribute("value"), Is.EqualTo("bob")); + Assert.That(typer.GetDomProperty("value"), Is.EqualTo("bob")); driver.FindElement(By.Id("red")).Click(); driver.FindElement(By.Name("submit")).Click(); @@ -250,7 +250,7 @@ public void ShouldBeAbleToExecuteAsynchronousScripts() "var callback = arguments[arguments.length - 1];" + "window.registerListener(arguments[arguments.length - 1]);"); Assert.That(text, Is.EqualTo("bob")); - Assert.That(typer.GetAttribute("value"), Is.Empty); + Assert.That(typer.GetDomProperty("value"), Is.Empty); Assert.That(GetNumberOfDivElements(), Is.EqualTo(2), "There should be 1 DIV (for the butter message) + 1 DIV (for the new label)"); } diff --git a/dotnet/test/common/FormHandlingTests.cs b/dotnet/test/common/FormHandlingTests.cs index 47382b7ebf8e1..0fc110a29fd63 100644 --- a/dotnet/test/common/FormHandlingTests.cs +++ b/dotnet/test/common/FormHandlingTests.cs @@ -111,7 +111,7 @@ public void ShouldBeAbleToEnterTextIntoATextAreaBySettingItsValue() IWebElement textarea = driver.FindElement(By.Id("keyUpArea")); string cheesey = "Brie and cheddar"; textarea.SendKeys(cheesey); - Assert.That(textarea.GetAttribute("value"), Is.EqualTo(cheesey)); + Assert.That(textarea.GetDomProperty("value"), Is.EqualTo(cheesey)); } [Test] @@ -121,7 +121,7 @@ public void SendKeysKeepsCapitalization() IWebElement textarea = driver.FindElement(By.Id("keyUpArea")); string cheesey = "BrIe And CheDdar"; textarea.SendKeys(cheesey); - Assert.That(textarea.GetAttribute("value"), Is.EqualTo(cheesey)); + Assert.That(textarea.GetDomProperty("value"), Is.EqualTo(cheesey)); } [Test] @@ -156,14 +156,14 @@ public void ShouldEnterDataIntoFormFields() { driver.Url = xhtmlTestPage; IWebElement element = driver.FindElement(By.XPath("//form[@name='someForm']/input[@id='username']")); - String originalValue = element.GetAttribute("value"); + String originalValue = element.GetDomProperty("value"); Assert.That(originalValue, Is.EqualTo("change")); element.Clear(); element.SendKeys("some text"); element = driver.FindElement(By.XPath("//form[@name='someForm']/input[@id='username']")); - String newFormValue = element.GetAttribute("value"); + String newFormValue = element.GetDomProperty("value"); Assert.That(newFormValue, Is.EqualTo("some text")); } @@ -173,7 +173,7 @@ public void ShouldBeAbleToAlterTheContentsOfAFileUploadInputElement() string testFileName = string.Format("test-{0}.txt", Guid.NewGuid().ToString("D")); driver.Url = formsPage; IWebElement uploadElement = driver.FindElement(By.Id("upload")); - Assert.That(uploadElement.GetAttribute("value"), Is.Null.Or.Empty); + Assert.That(uploadElement.GetDomProperty("value"), Is.Null.Or.Empty); string filePath = System.IO.Path.Combine(EnvironmentManager.Instance.CurrentDirectory, testFileName); System.IO.FileInfo inputFile = new System.IO.FileInfo(filePath); @@ -183,7 +183,7 @@ public void ShouldBeAbleToAlterTheContentsOfAFileUploadInputElement() uploadElement.SendKeys(inputFile.FullName); - string uploadElementValue = uploadElement.GetAttribute("value"); + string uploadElementValue = uploadElement.GetDomProperty("value"); System.IO.FileInfo outputFile = new System.IO.FileInfo(uploadElementValue.Replace('\\', System.IO.Path.DirectorySeparatorChar)); Assert.That(inputFile.Name, Is.EqualTo(outputFile.Name)); inputFile.Delete(); @@ -201,7 +201,7 @@ public void ShouldBeAbleToSendKeysToAFileUploadInputElementInAnXhtmlDocument() driver.Url = xhtmlFormPage; IWebElement uploadElement = driver.FindElement(By.Id("file")); - Assert.That(uploadElement.GetAttribute("value"), Is.Empty); + Assert.That(uploadElement.GetDomProperty("value"), Is.Empty); string testFileName = string.Format("test-{0}.txt", Guid.NewGuid().ToString("D")); string filePath = System.IO.Path.Combine(EnvironmentManager.Instance.CurrentDirectory, testFileName); @@ -212,7 +212,7 @@ public void ShouldBeAbleToSendKeysToAFileUploadInputElementInAnXhtmlDocument() uploadElement.SendKeys(inputFile.FullName); - string uploadElementValue = uploadElement.GetAttribute("value"); + string uploadElementValue = uploadElement.GetDomProperty("value"); System.IO.FileInfo outputFile = new System.IO.FileInfo(uploadElementValue.Replace('\\', System.IO.Path.DirectorySeparatorChar)); Assert.That(outputFile.Name, Is.EqualTo(inputFile.Name)); inputFile.Delete(); @@ -233,7 +233,7 @@ public void ShouldBeAbleToUploadTheSameFileTwice() { driver.Url = formsPage; IWebElement uploadElement = driver.FindElement(By.Id("upload")); - Assert.That(uploadElement.GetAttribute("value"), Is.Null.Or.EqualTo(string.Empty)); + Assert.That(uploadElement.GetDomProperty("value"), Is.Null.Or.EqualTo(string.Empty)); uploadElement.SendKeys(inputFile.FullName); uploadElement.Submit(); @@ -252,11 +252,11 @@ public void SendingKeyboardEventsShouldAppendTextInInputs() driver.Url = formsPage; IWebElement element = driver.FindElement(By.Id("working")); element.SendKeys("Some"); - String value = element.GetAttribute("value"); + String value = element.GetDomProperty("value"); Assert.That(value, Is.EqualTo("Some")); element.SendKeys(" text"); - value = element.GetAttribute("value"); + value = element.GetDomProperty("value"); Assert.That(value, Is.EqualTo("Some text")); } @@ -266,7 +266,7 @@ public void SendingKeyboardEventsShouldAppendTextInInputsWithExistingValue() driver.Url = formsPage; IWebElement element = driver.FindElement(By.Id("inputWithText")); element.SendKeys(". Some text"); - string value = element.GetAttribute("value"); + string value = element.GetDomProperty("value"); Assert.That(value, Is.EqualTo("Example text. Some text")); } @@ -278,7 +278,7 @@ public void SendingKeyboardEventsShouldAppendTextInTextAreas() IWebElement element = driver.FindElement(By.Id("withText")); element.SendKeys(". Some text"); - String value = element.GetAttribute("value"); + String value = element.GetDomProperty("value"); Assert.That(value, Is.EqualTo("Example text. Some text")); } @@ -288,10 +288,10 @@ public void EmptyTextBoxesShouldReturnAnEmptyStringNotNull() { driver.Url = formsPage; IWebElement emptyTextBox = driver.FindElement(By.Id("working")); - Assert.That(emptyTextBox.GetAttribute("value"), Is.Empty); + Assert.That(emptyTextBox.GetDomProperty("value"), Is.Empty); IWebElement emptyTextArea = driver.FindElement(By.Id("emptyTextArea")); - Assert.That(emptyTextBox.GetAttribute("value"), Is.Empty); + Assert.That(emptyTextBox.GetDomProperty("value"), Is.Empty); } [Test] @@ -390,11 +390,11 @@ public void ShouldBeAbleToClearTextFromInputElements() driver.Url = formsPage; IWebElement element = driver.FindElement(By.Id("working")); element.SendKeys("Some text"); - String value = element.GetAttribute("value"); + String value = element.GetDomProperty("value"); Assert.That(value, Is.Not.Empty); element.Clear(); - value = element.GetAttribute("value"); + value = element.GetDomProperty("value"); Assert.That(value, Is.Empty); } @@ -405,11 +405,11 @@ public void ShouldBeAbleToClearTextFromTextAreas() driver.Url = formsPage; IWebElement element = driver.FindElement(By.Id("withText")); element.SendKeys("Some text"); - String value = element.GetAttribute("value"); + String value = element.GetDomProperty("value"); Assert.That(value, Is.Not.Empty); element.Clear(); - value = element.GetAttribute("value"); + value = element.GetDomProperty("value"); Assert.That(value, Is.Empty); } diff --git a/dotnet/test/common/FrameSwitchingTest.cs b/dotnet/test/common/FrameSwitchingTest.cs index cd23b0c0bbbed..4053b61046574 100644 --- a/dotnet/test/common/FrameSwitchingTest.cs +++ b/dotnet/test/common/FrameSwitchingTest.cs @@ -93,7 +93,7 @@ public void ShouldBeAbleToSwitchToAnIframeByItsIndex() driver.Url = iframePage; driver.SwitchTo().Frame(0); - Assert.That(driver.FindElement(By.Name("id-name1")).GetAttribute("value"), Is.EqualTo("name")); + Assert.That(driver.FindElement(By.Name("id-name1")).GetDomProperty("value"), Is.EqualTo("name")); } [Test] @@ -110,7 +110,7 @@ public void ShouldBeAbleToSwitchToAnIframeByItsName() { driver.Url = iframePage; driver.SwitchTo().Frame("iframe1-name"); - Assert.That(driver.FindElement(By.Name("id-name1")).GetAttribute("value"), Is.EqualTo("name")); + Assert.That(driver.FindElement(By.Name("id-name1")).GetDomProperty("value"), Is.EqualTo("name")); } @@ -128,7 +128,7 @@ public void ShouldBeAbleToSwitchToAnIframeByItsID() { driver.Url = iframePage; driver.SwitchTo().Frame("iframe1"); - Assert.That(driver.FindElement(By.Name("id-name1")).GetAttribute("value"), Is.EqualTo("name")); + Assert.That(driver.FindElement(By.Name("id-name1")).GetDomProperty("value"), Is.EqualTo("name")); } [Test] @@ -154,7 +154,7 @@ public void ShouldBeAbleToSwitchToAnIFrameUsingAPreviouslyLocatedWebElement() driver.Url = iframePage; IWebElement frame = driver.FindElement(By.TagName("iframe")); driver.SwitchTo().Frame(frame); - Assert.That(driver.FindElement(By.Name("id-name1")).GetAttribute("value"), Is.EqualTo("name")); + Assert.That(driver.FindElement(By.Name("id-name1")).GetDomProperty("value"), Is.EqualTo("name")); } diff --git a/dotnet/test/common/I18Test.cs b/dotnet/test/common/I18Test.cs index eeed6e357e5c8..0e429bb8dc131 100644 --- a/dotnet/test/common/I18Test.cs +++ b/dotnet/test/common/I18Test.cs @@ -49,7 +49,7 @@ public void ShouldBeAbleToEnterHebrewTextFromLeftToRight() input.SendKeys(shalom); - Assert.That(input.GetAttribute("value"), Is.EqualTo(shalom)); + Assert.That(input.GetDomProperty("value"), Is.EqualTo(shalom)); } [Test] @@ -60,7 +60,7 @@ public void ShouldBeAbleToEnterHebrewTextFromRightToLeft() input.SendKeys(tmunot); - Assert.That(input.GetAttribute("value"), Is.EqualTo(tmunot)); + Assert.That(input.GetDomProperty("value"), Is.EqualTo(tmunot)); } [Test] @@ -86,7 +86,7 @@ public void ShouldBeAbleToEnterSupplementaryCharacters() IWebElement el = driver.FindElement(By.Name("i18n")); el.SendKeys(input); - Assert.That(el.GetAttribute("value"), Is.EqualTo(input)); + Assert.That(el.GetDomProperty("value"), Is.EqualTo(input)); } [Test] diff --git a/dotnet/test/common/Interactions/BasicKeyboardInterfaceTest.cs b/dotnet/test/common/Interactions/BasicKeyboardInterfaceTest.cs index 88c235a5a19b8..34c7aca65672b 100644 --- a/dotnet/test/common/Interactions/BasicKeyboardInterfaceTest.cs +++ b/dotnet/test/common/Interactions/BasicKeyboardInterfaceTest.cs @@ -77,7 +77,7 @@ public void ShouldAllowBasicKeyboardInput() sendLowercase.Perform(); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("abc def")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("abc def")); } @@ -154,7 +154,7 @@ public void ShouldAllowSendingKeysWithShiftPressed() AssertThatFormEventsFiredAreExactly("focus keydown keydown keypress keyup keydown keypress keyup keyup"); - Assert.That(keysEventInput.GetAttribute("value"), Is.EqualTo("AB")); + Assert.That(keysEventInput.GetDomProperty("value"), Is.EqualTo("AB")); } [Test] @@ -210,7 +210,7 @@ public void SelectionSelectBySymbol() new Actions(driver).Click(input).SendKeys("abc def").Perform(); - WaitFor(() => input.GetAttribute("value") == "abc def", "did not send initial keys"); + WaitFor(() => input.GetDomProperty("value") == "abc def", "did not send initial keys"); if (!TestUtilities.IsInternetExplorer(driver)) { @@ -235,7 +235,7 @@ public void SelectionSelectBySymbol() .SendKeys(Keys.Delete) .Perform(); - Assert.That(input.GetAttribute("value"), Is.EqualTo("abc d")); + Assert.That(input.GetDomProperty("value"), Is.EqualTo("abc d")); } [Test] @@ -253,7 +253,7 @@ public void SelectionSelectByWord() new Actions(driver).Click(input).SendKeys("abc def").Perform(); - WaitFor(() => input.GetAttribute("value") == "abc def", "did not send initial keys"); + WaitFor(() => input.GetDomProperty("value") == "abc def", "did not send initial keys"); if (!TestUtilities.IsInternetExplorer(driver)) { @@ -279,7 +279,7 @@ public void SelectionSelectByWord() .SendKeys(Keys.Delete) .Perform(); - WaitFor(() => input.GetAttribute("value") == "abc ", "did not send editing keys"); + WaitFor(() => input.GetDomProperty("value") == "abc ", "did not send editing keys"); } [Test] @@ -297,7 +297,7 @@ public void SelectionSelectAll() new Actions(driver).Click(input).SendKeys("abc def").Perform(); - WaitFor(() => input.GetAttribute("value") == "abc def", "did not send initial keys"); + WaitFor(() => input.GetDomProperty("value") == "abc def", "did not send initial keys"); new Actions(driver).Click(input) .KeyDown(controlModifier) @@ -306,7 +306,7 @@ public void SelectionSelectAll() .SendKeys(Keys.Delete) .Perform(); - Assert.That(input.GetAttribute("value"), Is.EqualTo(string.Empty)); + Assert.That(input.GetDomProperty("value"), Is.EqualTo(string.Empty)); } //------------------------------------------------------------------ @@ -333,7 +333,7 @@ public void ShouldAllowSendingKeysWithLeftShiftPressed() AssertThatFormEventsFiredAreExactly("focus keydown keydown keypress keyup keydown keypress keyup keyup"); - Assert.That(keysEventInput.GetAttribute("value"), Is.EqualTo("AB")); + Assert.That(keysEventInput.GetDomProperty("value"), Is.EqualTo("AB")); } private void AssertThatFormEventsFiredAreExactly(string message, string expected) diff --git a/dotnet/test/common/Interactions/BasicMouseInterfaceTest.cs b/dotnet/test/common/Interactions/BasicMouseInterfaceTest.cs index 41ffa4812164f..18ae5b34b94c9 100644 --- a/dotnet/test/common/Interactions/BasicMouseInterfaceTest.cs +++ b/dotnet/test/common/Interactions/BasicMouseInterfaceTest.cs @@ -130,7 +130,7 @@ public void ShouldAllowDoubleClick() IAction dblClick = actionProvider.DoubleClick(toDoubleClick).Build(); dblClick.Perform(); - Assert.That(toDoubleClick.GetAttribute("value"), Is.EqualTo("DoubleClicked")); + Assert.That(toDoubleClick.GetDomProperty("value"), Is.EqualTo("DoubleClicked")); } [Test] @@ -144,7 +144,7 @@ public void ShouldAllowContextClick() IAction contextClick = actionProvider.ContextClick(toContextClick).Build(); contextClick.Perform(); - Assert.That(toContextClick.GetAttribute("value"), Is.EqualTo("ContextClicked")); + Assert.That(toContextClick.GetDomProperty("value"), Is.EqualTo("ContextClicked")); } [Test] @@ -159,7 +159,7 @@ public void ShouldAllowMoveAndClick() IAction contextClick = actionProvider.MoveToElement(toClick).Click().Build(); contextClick.Perform(); - Assert.That(toClick.GetAttribute("value"), Is.EqualTo("Clicked"), "Value should change to Clicked."); + Assert.That(toClick.GetDomProperty("value"), Is.EqualTo("Clicked"), "Value should change to Clicked."); } [Test] diff --git a/dotnet/test/common/Interactions/CombinedInputActionsTest.cs b/dotnet/test/common/Interactions/CombinedInputActionsTest.cs index 9fcb0d42422c7..b2faf3ded4231 100644 --- a/dotnet/test/common/Interactions/CombinedInputActionsTest.cs +++ b/dotnet/test/common/Interactions/CombinedInputActionsTest.cs @@ -292,7 +292,7 @@ public void ChordControlCutAndPaste() .SendKeys(element, "abc def") .Perform(); - Assert.That(element.GetAttribute("value"), Is.EqualTo("abc def")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("abc def")); //TODO: Figure out why calling sendKey(Key.CONTROL + "a") and then //sendKeys("x") does not work on Linux. @@ -303,7 +303,7 @@ public void ChordControlCutAndPaste() // Release keys before next step. new Actions(driver).SendKeys(Keys.Null).Perform(); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); new Actions(driver).KeyDown(controlModifier) .SendKeys("v") @@ -312,7 +312,7 @@ public void ChordControlCutAndPaste() new Actions(driver).SendKeys(Keys.Null).Perform(); - Assert.That(element.GetAttribute("value"), Is.EqualTo("abc defabc def")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("abc defabc def")); } [Test] diff --git a/dotnet/test/common/JavascriptEnabledBrowserTest.cs b/dotnet/test/common/JavascriptEnabledBrowserTest.cs index ea9d267db29d8..c9617e1c725c7 100644 --- a/dotnet/test/common/JavascriptEnabledBrowserTest.cs +++ b/dotnet/test/common/JavascriptEnabledBrowserTest.cs @@ -113,11 +113,11 @@ public void Issue80ClickShouldGenerateClickEvent() { driver.Url = javascriptPage; IWebElement element = driver.FindElement(By.Id("clickField")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("Hello")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("Hello")); element.Click(); - Assert.That(element.GetAttribute("value"), Is.EqualTo("Clicked")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("Clicked")); } [Test] diff --git a/dotnet/test/common/SelectElementHandlingTest.cs b/dotnet/test/common/SelectElementHandlingTest.cs index 99ca4bd014251..f30812b9a6577 100644 --- a/dotnet/test/common/SelectElementHandlingTest.cs +++ b/dotnet/test/common/SelectElementHandlingTest.cs @@ -113,9 +113,9 @@ public void CanGetValueFromOptionViaAttributeWhenAttributeDoesntExist() { driver.Url = formsPage; IWebElement element = driver.FindElement(By.CssSelector("select[name='select-default'] option")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("One")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("One")); element = driver.FindElement(By.Id("blankOption")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("")); } [Test] @@ -123,7 +123,7 @@ public void CanGetValueFromOptionViaAttributeWhenAttributeIsEmptyString() { driver.Url = formsPage; IWebElement element = driver.FindElement(By.Id("optionEmptyValueSet")); - Assert.That(element.GetAttribute("value"), Is.EqualTo("")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("")); } [Test] diff --git a/dotnet/test/common/TextHandlingTest.cs b/dotnet/test/common/TextHandlingTest.cs index 3b66fe86dd2c4..1e1eb1a11a4b5 100644 --- a/dotnet/test/common/TextHandlingTest.cs +++ b/dotnet/test/common/TextHandlingTest.cs @@ -194,7 +194,7 @@ public void ShouldBeAbleToSetMoreThanOneLineOfTextInATextArea() string expectedText = "I like cheese" + NewLine + NewLine + "It's really nice"; textarea.SendKeys(expectedText); - string seenText = textarea.GetAttribute("value"); + string seenText = textarea.GetDomProperty("value"); Assert.That(seenText, Is.EqualTo(expectedText)); } @@ -205,7 +205,7 @@ public void ShouldBeAbleToEnterDatesAfterFillingInOtherValuesFirst() IWebElement input = driver.FindElement(By.Id("working")); string expectedValue = "10/03/2007 to 30/07/1993"; input.SendKeys(expectedValue); - string seenValue = input.GetAttribute("value"); + string seenValue = input.GetDomProperty("value"); Assert.That(expectedValue, Is.EqualTo(seenValue)); } @@ -354,7 +354,7 @@ public void TextOfATextAreaShouldBeEqualToItsDefaultTextEvenAfterChangingTheValu { driver.Url = formsPage; IWebElement area = driver.FindElement(By.Id("withText")); - string oldText = area.GetAttribute("value"); + string oldText = area.GetDomProperty("value"); ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].value = arguments[1]", area, "New Text"); Assert.That(area.Text, Is.EqualTo(oldText)); } diff --git a/dotnet/test/common/TypingTest.cs b/dotnet/test/common/TypingTest.cs index 55caf6f76cfe0..3561923fd1a49 100644 --- a/dotnet/test/common/TypingTest.cs +++ b/dotnet/test/common/TypingTest.cs @@ -74,7 +74,7 @@ public void ShouldTypeLowerCaseLetters() IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys("abc def"); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("abc def")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("abc def")); } [Test] @@ -85,7 +85,7 @@ public void ShouldBeAbleToTypeCapitalLetters() IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys("ABC DEF"); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("ABC DEF")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("ABC DEF")); } [Test] @@ -96,7 +96,7 @@ public void ShouldBeAbleToTypeQuoteMarks() IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys("\""); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("\"")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("\"")); } [Test] @@ -113,7 +113,7 @@ public void ShouldBeAbleToTypeTheAtCharacter() IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys("@"); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("@")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("@")); } [Test] @@ -124,7 +124,7 @@ public void ShouldBeAbleToMixUpperAndLowerCaseLetters() IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys("me@eXample.com"); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("me@eXample.com")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("me@eXample.com")); } [Test] @@ -135,7 +135,7 @@ public void ArrowKeysShouldNotBePrintable() IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys(Keys.ArrowLeft); - Assert.That(keyReporter.GetAttribute("value"), Is.Empty); + Assert.That(keyReporter.GetDomProperty("value"), Is.Empty); } [Test] @@ -146,7 +146,7 @@ public void ShouldBeAbleToUseArrowKeys() IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys("Tet" + Keys.ArrowLeft + "s"); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("Test")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("Test")); } [Test] @@ -262,7 +262,7 @@ public void ShouldReportKeyCodeOfArrowKeys() CheckRecordedKeySequence(result, 39); // And leave no rubbish/printable keys in the "keyReporter" - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); } [Test] @@ -294,7 +294,7 @@ public void ShouldReportKeyCodeOfArrowKeysUpDownEvents() Assert.That(text, Does.Contain("up: 39")); // And leave no rubbish/printable keys in the "keyReporter" - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); } [Test] @@ -307,7 +307,7 @@ public void NumericNonShiftKeys() string numericLineCharsNonShifted = "`1234567890-=[]\\;,.'/42"; element.SendKeys(numericLineCharsNonShifted); - Assert.That(element.GetAttribute("value"), Is.EqualTo(numericLineCharsNonShifted)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(numericLineCharsNonShifted)); } [Test] @@ -322,7 +322,7 @@ public void NumericShiftKeys() string numericShiftsEtc = "~!@#$%^&*()_+{}:\"<>?|END~"; element.SendKeys(numericShiftsEtc); - Assert.That(element.GetAttribute("value"), Is.EqualTo(numericShiftsEtc)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(numericShiftsEtc)); string text = result.Text.Trim(); Assert.That(text, Does.Contain(" up: 16")); } @@ -337,7 +337,7 @@ public void LowerCaseAlphaKeys() String lowerAlphas = "abcdefghijklmnopqrstuvwxyz"; element.SendKeys(lowerAlphas); - Assert.That(element.GetAttribute("value"), Is.EqualTo(lowerAlphas)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(lowerAlphas)); } [Test] @@ -352,7 +352,7 @@ public void UppercaseAlphaKeys() String upperAlphas = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; element.SendKeys(upperAlphas); - Assert.That(element.GetAttribute("value"), Is.EqualTo(upperAlphas)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(upperAlphas)); string text = result.Text.Trim(); Assert.That(text, Does.Contain(" up: 16")); } @@ -371,7 +371,7 @@ public void AllPrintableKeys() "PQRSTUVWXYZ [\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; element.SendKeys(allPrintable); - Assert.That(element.GetAttribute("value"), Is.EqualTo(allPrintable)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(allPrintable)); string text = result.Text.Trim(); Assert.That(text, Does.Contain(" up: 16")); } @@ -385,7 +385,7 @@ public void ArrowKeysAndPageUpAndDown() element.SendKeys("a" + Keys.Left + "b" + Keys.Right + Keys.Up + Keys.Down + Keys.PageUp + Keys.PageDown + "1"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("ba1")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("ba1")); } [Test] @@ -399,7 +399,7 @@ public void HomeAndEndAndPageUpAndPageDownKeys() element.SendKeys("abc" + HomeKey() + "0" + Keys.Left + Keys.Right + Keys.PageUp + Keys.PageDown + EndKey() + "1" + HomeKey() + "0" + Keys.PageUp + EndKey() + "111" + HomeKey() + "00"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("0000abc1111")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("0000abc1111")); } [Test] @@ -410,13 +410,13 @@ public void DeleteAndBackspaceKeys() IWebElement element = driver.FindElement(By.Id("keyReporter")); element.SendKeys("abcdefghi"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("abcdefghi")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("abcdefghi")); element.SendKeys(Keys.Left + Keys.Left + Keys.Delete); - Assert.That(element.GetAttribute("value"), Is.EqualTo("abcdefgi")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("abcdefgi")); element.SendKeys(Keys.Left + Keys.Left + Keys.Backspace); - Assert.That(element.GetAttribute("value"), Is.EqualTo("abcdfgi")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("abcdfgi")); } [Test] @@ -427,7 +427,7 @@ public void SpecialSpaceKeys() IWebElement element = driver.FindElement(By.Id("keyReporter")); element.SendKeys("abcd" + Keys.Space + "fgh" + Keys.Space + "ij"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("abcd fgh ij")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("abcd fgh ij")); } [Test] @@ -441,7 +441,7 @@ public void NumberpadKeys() Keys.Decimal + Keys.Separator + Keys.NumberPad0 + Keys.NumberPad9 + Keys.Add + Keys.Semicolon + Keys.Equal + Keys.Divide + Keys.NumberPad3 + "abcd"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("abcd*-+.,09+;=/3abcd")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("abcd*-+.,09+;=/3abcd")); } [Test] @@ -453,7 +453,7 @@ public void FunctionKeys() element.SendKeys("FUNCTION" + Keys.F8 + "-KEYS" + Keys.F8); element.SendKeys("" + Keys.F8 + "-TOO" + Keys.F8); - Assert.That(element.GetAttribute("value"), Is.EqualTo("FUNCTION-KEYS-TOO")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("FUNCTION-KEYS-TOO")); } [Test] @@ -464,12 +464,12 @@ public void ShiftSelectionDeletes() IWebElement element = driver.FindElement(By.Id("keyReporter")); element.SendKeys("abcd efgh"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("abcd efgh")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("abcd efgh")); //Could be chord problem element.SendKeys(Keys.Shift + Keys.Left + Keys.Left + Keys.Left); element.SendKeys(Keys.Delete); - Assert.That(element.GetAttribute("value"), Is.EqualTo("abcd e")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("abcd e")); } [Test] @@ -486,7 +486,7 @@ public void ChordControlHomeShiftEndDelete() element.SendKeys(HomeKey()); element.SendKeys("" + Keys.Shift + EndKey() + Keys.Delete); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); string text = result.Text.Trim(); Assert.That(text, Does.Contain(" up: 16")); } @@ -501,22 +501,22 @@ public void ChordReverseShiftHomeSelectionDeletes() IWebElement element = driver.FindElement(By.Id("keyReporter")); element.SendKeys("done" + HomeKey()); - Assert.That(element.GetAttribute("value"), Is.EqualTo("done")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("done")); //Sending chords element.SendKeys("" + Keys.Shift + "ALL " + HomeKey()); - Assert.That(element.GetAttribute("value"), Is.EqualTo("ALL done")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("ALL done")); element.SendKeys(Keys.Delete); - Assert.That(element.GetAttribute("value"), Is.EqualTo("done"), "done"); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("done"), "done"); element.SendKeys("" + EndKey() + Keys.Shift + HomeKey()); - Assert.That(element.GetAttribute("value"), Is.EqualTo("done")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("done")); // Note: trailing SHIFT up here string text = result.Text.Trim(); element.SendKeys("" + Keys.Delete); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); } [Test] @@ -529,31 +529,31 @@ public void ChordControlCutAndPaste() String paste = "!\"#$%&'()*+,-./0123456789:;<=>?@ ABCDEFG"; element.SendKeys(paste); - Assert.That(element.GetAttribute("value"), Is.EqualTo(paste)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(paste)); //Chords element.SendKeys("" + HomeKey() + Keys.Shift + EndKey()); element.SendKeys(PrimaryModifier() + "x"); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); element.SendKeys(PrimaryModifier() + "v"); - Assert.That(element.GetAttribute("value"), Is.EqualTo(paste)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(paste)); element.SendKeys("" + Keys.Left + Keys.Left + Keys.Left + Keys.Shift + EndKey()); element.SendKeys(PrimaryModifier() + "x" + "v"); - Assert.That(element.GetAttribute("value"), Is.EqualTo(paste)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo(paste)); element.SendKeys(HomeKey()); element.SendKeys(PrimaryModifier() + "v"); element.SendKeys(PrimaryModifier() + "v" + "v"); element.SendKeys(PrimaryModifier() + "v" + "v" + "v"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("EFGEFGEFGEFGEFGEFG" + paste)); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("EFGEFGEFGEFGEFGEFG" + paste)); element.SendKeys("" + EndKey() + Keys.Shift + HomeKey() + Keys.Null + Keys.Delete); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); } [Test] @@ -564,7 +564,7 @@ public void ShouldTypeIntoInputElementsThatHaveNoTypeAttribute() IWebElement element = driver.FindElement(By.Id("no-type")); element.SendKeys("Should Say Cheese"); - Assert.That(element.GetAttribute("value"), Is.EqualTo("Should Say Cheese")); + Assert.That(element.GetDomProperty("value"), Is.EqualTo("Should Say Cheese")); } [Test] @@ -575,7 +575,7 @@ public void ShouldNotTypeIntoElementsThatPreventKeyDownEvents() IWebElement silent = driver.FindElement(By.Name("suppress")); silent.SendKeys("s"); - Assert.That(silent.GetAttribute("value"), Is.Empty); + Assert.That(silent.GetDomProperty("value"), Is.Empty); } [Test] @@ -596,7 +596,7 @@ public void ShouldBeAbleToTypeOnAnEmailInputField() driver.Url = formsPage; IWebElement email = driver.FindElement(By.Id("email")); email.SendKeys("foobar"); - Assert.That(email.GetAttribute("value"), Is.EqualTo("foobar")); + Assert.That(email.GetDomProperty("value"), Is.EqualTo("foobar")); } [Test] @@ -605,7 +605,7 @@ public void ShouldBeAbleToTypeOnANumberInputField() driver.Url = formsPage; IWebElement numberElement = driver.FindElement(By.Id("age")); numberElement.SendKeys("33"); - Assert.That(numberElement.GetAttribute("value"), Is.EqualTo("33")); + Assert.That(numberElement.GetDomProperty("value"), Is.EqualTo("33")); } [Test] @@ -624,7 +624,7 @@ public void CanSafelyTypeOnElementThatIsRemovedFromTheDomOnKeyPress() IWebElement input = driver.FindElement(By.Id("target")); IWebElement log = driver.FindElement(By.Id("log")); - Assert.That(log.GetAttribute("value"), Is.EqualTo("")); + Assert.That(log.GetDomProperty("value"), Is.EqualTo("")); input.SendKeys("b"); string expected = "keydown (target)\nkeyup (target)\nkeyup (body)"; @@ -647,7 +647,7 @@ public void CanClearNumberInputAfterTypingInvalidInput() input.SendKeys("e"); input.Clear(); input.SendKeys("3"); - Assert.That(input.GetAttribute("value"), Is.EqualTo("3")); + Assert.That(input.GetDomProperty("value"), Is.EqualTo("3")); } //------------------------------------------------------------------ @@ -732,7 +732,7 @@ public void ShouldBeAbleToTypeIntoTinyMCE() private string GetValueText(IWebElement el) { // Standardize on \n and strip any trailing whitespace. - return el.GetAttribute("value").Replace("\r\n", "\n").Trim(); + return el.GetDomProperty("value").Replace("\r\n", "\n").Trim(); } private void CheckRecordedKeySequence(IWebElement element, int expectedKeyCode) diff --git a/dotnet/test/common/UploadTest.cs b/dotnet/test/common/UploadTest.cs index 5608e1e5d2747..5d9994ac43627 100644 --- a/dotnet/test/common/UploadTest.cs +++ b/dotnet/test/common/UploadTest.cs @@ -69,7 +69,7 @@ public void CleanFileInput() IWebElement element = driver.FindElement(By.Id("upload")); element.SendKeys(testFile.FullName); element.Clear(); - Assert.That(element.GetAttribute("value"), Is.Empty); + Assert.That(element.GetDomProperty("value"), Is.Empty); } [Test] diff --git a/dotnet/test/common/VisibilityTest.cs b/dotnet/test/common/VisibilityTest.cs index 527699e6d8f88..382d224c7caa2 100644 --- a/dotnet/test/common/VisibilityTest.cs +++ b/dotnet/test/common/VisibilityTest.cs @@ -100,7 +100,7 @@ public void ShouldNotBeAbleToTypeAnElementThatIsNotDisplayed() IWebElement element = driver.FindElement(By.Id("unclickable")); Assert.That(() => element.SendKeys("You don't see me"), Throws.InstanceOf()); - Assert.That(element.GetAttribute("value"), Is.Not.EqualTo("You don't see me")); + Assert.That(element.GetDomProperty("value"), Is.Not.EqualTo("You don't see me")); } [Test] diff --git a/dotnet/test/common/WebElementTest.cs b/dotnet/test/common/WebElementTest.cs index 9fcf68ee1b0f4..79d191f5da89e 100644 --- a/dotnet/test/common/WebElementTest.cs +++ b/dotnet/test/common/WebElementTest.cs @@ -110,7 +110,7 @@ public void ShouldClearElement() IWebElement textbox = driver.FindElement(By.Id("keyUp")); textbox.SendKeys("a@#$ç.ó"); textbox.Clear(); - Assert.That(textbox.GetAttribute("value"), Is.Empty); + Assert.That(textbox.GetDomProperty("value"), Is.Empty); } [Test] @@ -121,7 +121,7 @@ public void ShouldClearRenderedElement() IWebElement textbox = driver.FindElement(By.Id("keyUp")); textbox.SendKeys("a@#$ç.ó"); textbox.Clear(); - Assert.That(textbox.GetAttribute("value"), Is.Empty); + Assert.That(textbox.GetDomProperty("value"), Is.Empty); } [Test] @@ -131,7 +131,7 @@ public void ShouldSendKeysToElement() IWebElement textbox = driver.FindElement(By.Id("keyUp")); textbox.SendKeys("a@#$ç.ó"); - Assert.That(textbox.GetAttribute("value"), Is.EqualTo("a@#$ç.ó")); + Assert.That(textbox.GetDomProperty("value"), Is.EqualTo("a@#$ç.ó")); } [Test] diff --git a/dotnet/test/firefox/FirefoxDriverTest.cs b/dotnet/test/firefox/FirefoxDriverTest.cs index 0de306815de96..20c697be6e1ac 100644 --- a/dotnet/test/firefox/FirefoxDriverTest.cs +++ b/dotnet/test/firefox/FirefoxDriverTest.cs @@ -57,7 +57,7 @@ public void ShouldWaitUntilBrowserHasClosedProperly() textarea.Clear(); textarea.SendKeys(expectedText); - string seenText = textarea.GetAttribute("value"); + string seenText = textarea.GetDomProperty("value"); Assert.That(seenText, Is.EqualTo(expectedText)); } @@ -127,7 +127,7 @@ public void FocusRemainsInOriginalWindowWhenOpeningNewWindow() IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys("ABC DEF"); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("ABC DEF")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("ABC DEF")); } //[Test] @@ -163,7 +163,7 @@ public void SwitchingWindowShouldSwitchFocus() IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys("ABC DEF"); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("ABC DEF")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("ABC DEF")); // Key events in original window. driver.SwitchTo().Window(originalWinHandle); @@ -172,7 +172,7 @@ public void SwitchingWindowShouldSwitchFocus() IWebElement keyReporter2 = driver.FindElement(By.Id("keyReporter")); keyReporter2.SendKeys("QWERTY"); - Assert.That(keyReporter2.GetAttribute("value"), Is.EqualTo("QWERTY")); + Assert.That(keyReporter2.GetDomProperty("value"), Is.EqualTo("QWERTY")); } //[Test] @@ -211,7 +211,7 @@ public void ClosingWindowAndSwitchingToOriginalSwitchesFocus() driver.Url = javascriptPage; IWebElement keyReporter = driver.FindElement(By.Id("keyReporter")); keyReporter.SendKeys("ABC DEF"); - Assert.That(keyReporter.GetAttribute("value"), Is.EqualTo("ABC DEF")); + Assert.That(keyReporter.GetDomProperty("value"), Is.EqualTo("ABC DEF")); } //[Test] From 46b9ed69de2e732b6e29969481cec945482db1ac Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 14:58:56 +0300 Subject: [PATCH 02/35] Get attribute id --- dotnet/test/common/ChildrenFindingTest.cs | 12 +++++------ dotnet/test/common/ElementAttributeTest.cs | 4 ++-- dotnet/test/common/ElementFindingTest.cs | 20 +++++++++---------- dotnet/test/common/ElementSelectingTest.cs | 2 +- .../common/JavascriptEnabledBrowserTest.cs | 2 +- .../test/common/PartialLinkTextMatchTest.cs | 4 ++-- dotnet/test/common/WebElementTest.cs | 4 ++-- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dotnet/test/common/ChildrenFindingTest.cs b/dotnet/test/common/ChildrenFindingTest.cs index 6588c7c88a43a..bad207407a6fc 100644 --- a/dotnet/test/common/ChildrenFindingTest.cs +++ b/dotnet/test/common/ChildrenFindingTest.cs @@ -31,7 +31,7 @@ public void FindElementByXPath() driver.Url = nestedPage; IWebElement element = driver.FindElement(By.Name("form2")); IWebElement child = element.FindElement(By.XPath("select")); - Assert.That(child.GetAttribute("id"), Is.EqualTo("2")); + Assert.That(child.GetDomAttribute("id"), Is.EqualTo("2")); } [Test] @@ -93,7 +93,7 @@ public void FindElementByName() driver.Url = nestedPage; IWebElement element = driver.FindElement(By.Name("form2")); IWebElement child = element.FindElement(By.Name("selectomatic")); - Assert.That(child.GetAttribute("id"), Is.EqualTo("2")); + Assert.That(child.GetDomAttribute("id"), Is.EqualTo("2")); } [Test] @@ -269,7 +269,7 @@ public void ShouldBeAbleToFindAnElementByCssSelector() IWebElement element = parent.FindElement(By.CssSelector("*[name=\"selectomatic\"]")); - Assert.That(element.GetAttribute("id"), Is.EqualTo("2")); + Assert.That(element.GetDomAttribute("id"), Is.EqualTo("2")); } [Test] @@ -280,7 +280,7 @@ public void ShouldBeAbleToFindAnElementByCss3Selector() IWebElement element = parent.FindElement(By.CssSelector("*[name^=\"selecto\"]")); - Assert.That(element.GetAttribute("id"), Is.EqualTo("2")); + Assert.That(element.GetDomAttribute("id"), Is.EqualTo("2")); } [Test] @@ -350,7 +350,7 @@ public void FindingByCssShouldNotIncludeParentElementIfSameTagType() IWebElement parent = driver.FindElement(By.CssSelector("div#parent")); IWebElement child = parent.FindElement(By.CssSelector("div")); - Assert.That(child.GetAttribute("id"), Is.EqualTo("child")); + Assert.That(child.GetDomAttribute("id"), Is.EqualTo("child")); } [Test] @@ -393,7 +393,7 @@ public void ElementCanGetLinkByLinkTestIgnoringTrailingWhitespace() IWebElement elem = driver.FindElement(By.Id("links")); IWebElement link = elem.FindElement(By.LinkText("link with trailing space")); - Assert.That(link.GetAttribute("id"), Is.EqualTo("linkWithTrailingSpace")); + Assert.That(link.GetDomAttribute("id"), Is.EqualTo("linkWithTrailingSpace")); } } } diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index c620477d1ac72..9b5399b7f98b6 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -288,10 +288,10 @@ public void ShouldCorrectlyReportValueOfColspan() IWebElement th1 = driver.FindElement(By.Id("th1")); IWebElement td2 = driver.FindElement(By.Id("td2")); - Assert.That(th1.GetAttribute("id"), Is.EqualTo("th1"), "th1 id"); + Assert.That(th1.GetDomAttribute("id"), Is.EqualTo("th1"), "th1 id"); Assert.That(th1.GetAttribute("colspan"), Is.EqualTo("3"), "th1 colspan should be 3"); - Assert.That(td2.GetAttribute("id"), Is.EqualTo("td2"), "td2 id"); + Assert.That(td2.GetDomAttribute("id"), Is.EqualTo("td2"), "td2 id"); Assert.That(td2.GetAttribute("colspan"), Is.EqualTo("2"), "td2 colspan should be 2"); } diff --git a/dotnet/test/common/ElementFindingTest.cs b/dotnet/test/common/ElementFindingTest.cs index df26a0bf6259a..ef80108c602f3 100644 --- a/dotnet/test/common/ElementFindingTest.cs +++ b/dotnet/test/common/ElementFindingTest.cs @@ -34,7 +34,7 @@ public void ShouldBeAbleToFindASingleElementById() { driver.Url = xhtmlTestPage; IWebElement element = driver.FindElement(By.Id("linkId")); - Assert.That(element.GetAttribute("id"), Is.EqualTo("linkId")); + Assert.That(element.GetDomAttribute("id"), Is.EqualTo("linkId")); } [Test] @@ -42,7 +42,7 @@ public void ShouldBeAbleToFindASingleElementByNumericId() { driver.Url = nestedPage; IWebElement element = driver.FindElement(By.Id("2")); - Assert.That(element.GetAttribute("id"), Is.EqualTo("2")); + Assert.That(element.GetDomAttribute("id"), Is.EqualTo("2")); } [Test] @@ -681,7 +681,7 @@ public void ShouldFindElementByLinkTextContainingEqualsSign() { driver.Url = xhtmlTestPage; IWebElement element = driver.FindElement(By.LinkText("Link=equalssign")); - Assert.That(element.GetAttribute("id"), Is.EqualTo("linkWithEqualsSign")); + Assert.That(element.GetDomAttribute("id"), Is.EqualTo("linkWithEqualsSign")); } [Test] @@ -690,7 +690,7 @@ public void ShouldFindMultipleElementsByLinkTextContainingEqualsSign() driver.Url = xhtmlTestPage; ReadOnlyCollection elements = driver.FindElements(By.LinkText("Link=equalssign")); Assert.That(elements, Has.Count.EqualTo(1)); - Assert.That(elements[0].GetAttribute("id"), Is.EqualTo("linkWithEqualsSign")); + Assert.That(elements[0].GetDomAttribute("id"), Is.EqualTo("linkWithEqualsSign")); } [Test] @@ -724,7 +724,7 @@ public void DriverCanGetLinkByLinkTestIgnoringTrailingWhitespace() { driver.Url = simpleTestPage; IWebElement link = driver.FindElement(By.LinkText("link with trailing space")); - Assert.That(link.GetAttribute("id"), Is.EqualTo("linkWithTrailingSpace")); + Assert.That(link.GetDomAttribute("id"), Is.EqualTo("linkWithTrailingSpace")); Assert.That(link.Text, Is.EqualTo("link with trailing space")); } @@ -768,7 +768,7 @@ public void ShouldFindElementByPartialLinkTextContainingEqualsSign() { driver.Url = xhtmlTestPage; IWebElement element = driver.FindElement(By.PartialLinkText("Link=")); - Assert.That(element.GetAttribute("id"), Is.EqualTo("linkWithEqualsSign")); + Assert.That(element.GetDomAttribute("id"), Is.EqualTo("linkWithEqualsSign")); } [Test] @@ -777,7 +777,7 @@ public void ShouldFindMultipleElementsByPartialLinkTextContainingEqualsSign() driver.Url = xhtmlTestPage; ReadOnlyCollection elements = driver.FindElements(By.PartialLinkText("Link=")); Assert.That(elements, Has.Count.EqualTo(1)); - Assert.That(elements[0].GetAttribute("id"), Is.EqualTo("linkWithEqualsSign")); + Assert.That(elements[0].GetDomAttribute("id"), Is.EqualTo("linkWithEqualsSign")); } // Misc tests @@ -996,7 +996,7 @@ public void FindingByCssShouldNotIncludeParentElementIfSameTagType() IWebElement parent = driver.FindElement(By.CssSelector("div#parent")); IWebElement child = parent.FindElement(By.CssSelector("div")); - Assert.That(child.GetAttribute("id"), Is.EqualTo("child")); + Assert.That(child.GetDomAttribute("id"), Is.EqualTo("child")); } [Test] @@ -1025,7 +1025,7 @@ public void ShouldFindElementByLinkTextContainingDoubleQuote() { driver.Url = simpleTestPage; IWebElement element = driver.FindElement(By.LinkText("link with \" (double quote)")); - Assert.That(element.GetAttribute("id"), Is.EqualTo("quote")); + Assert.That(element.GetDomAttribute("id"), Is.EqualTo("quote")); } [Test] @@ -1033,7 +1033,7 @@ public void ShouldFindElementByLinkTextContainingBackslash() { driver.Url = simpleTestPage; IWebElement element = driver.FindElement(By.LinkText("link with \\ (backslash)")); - Assert.That(element.GetAttribute("id"), Is.EqualTo("backslash")); + Assert.That(element.GetDomAttribute("id"), Is.EqualTo("backslash")); } } } diff --git a/dotnet/test/common/ElementSelectingTest.cs b/dotnet/test/common/ElementSelectingTest.cs index 6d9bb1a7125ac..b4321e2f3d250 100644 --- a/dotnet/test/common/ElementSelectingTest.cs +++ b/dotnet/test/common/ElementSelectingTest.cs @@ -244,7 +244,7 @@ private static string SelectedToString(bool isSelected) private static string Describe(IWebElement element) { - return element.GetAttribute("id"); + return element.GetDomAttribute("id"); } private static void AssertCanToggle(IWebElement element) diff --git a/dotnet/test/common/JavascriptEnabledBrowserTest.cs b/dotnet/test/common/JavascriptEnabledBrowserTest.cs index c9617e1c725c7..8075a95b46466 100644 --- a/dotnet/test/common/JavascriptEnabledBrowserTest.cs +++ b/dotnet/test/common/JavascriptEnabledBrowserTest.cs @@ -128,7 +128,7 @@ public void ShouldBeAbleToSwitchToFocusedElement() driver.FindElement(By.Id("switchFocus")).Click(); IWebElement element = driver.SwitchTo().ActiveElement(); - Assert.That(element.GetAttribute("id"), Is.EqualTo("theworks")); + Assert.That(element.GetDomAttribute("id"), Is.EqualTo("theworks")); } [Test] diff --git a/dotnet/test/common/PartialLinkTextMatchTest.cs b/dotnet/test/common/PartialLinkTextMatchTest.cs index 1d69fe0b7aea7..c5d91c9104f1d 100644 --- a/dotnet/test/common/PartialLinkTextMatchTest.cs +++ b/dotnet/test/common/PartialLinkTextMatchTest.cs @@ -76,7 +76,7 @@ public void DriverCanGetLinkByLinkTestIgnoringTrailingWhitespace() driver.Url = simpleTestPage; IWebElement link = null; link = driver.FindElement(By.LinkText("link with trailing space")); - Assert.That(link.GetAttribute("id"), Is.EqualTo("linkWithTrailingSpace")); + Assert.That(link.GetDomAttribute("id"), Is.EqualTo("linkWithTrailingSpace")); } [Test] @@ -87,7 +87,7 @@ public void ElementCanGetLinkByLinkTestIgnoringTrailingWhitespace() IWebElement link = null; link = elem.FindElement(By.LinkText("link with trailing space")); - Assert.That(link.GetAttribute("id"), Is.EqualTo("linkWithTrailingSpace")); + Assert.That(link.GetDomAttribute("id"), Is.EqualTo("linkWithTrailingSpace")); } } } diff --git a/dotnet/test/common/WebElementTest.cs b/dotnet/test/common/WebElementTest.cs index 79d191f5da89e..e6de47c33f49d 100644 --- a/dotnet/test/common/WebElementTest.cs +++ b/dotnet/test/common/WebElementTest.cs @@ -162,8 +162,8 @@ public void ShouldGetAttributesFromElement() IWebElement dynamo = driver.FindElement(By.Id("dynamo")); IWebElement mousedown = driver.FindElement(By.Id("mousedown")); - Assert.That(mousedown.GetAttribute("id"), Is.EqualTo("mousedown")); - Assert.That(dynamo.GetAttribute("id"), Is.EqualTo("dynamo")); + Assert.That(mousedown.GetDomAttribute("id"), Is.EqualTo("mousedown")); + Assert.That(dynamo.GetDomAttribute("id"), Is.EqualTo("dynamo")); } } From 7328f50f39b7bbde8c0e1bc0c270449329f6e0bd Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 15:00:12 +0300 Subject: [PATCH 03/35] name --- dotnet/test/common/ChildrenFindingTest.cs | 10 +++++----- dotnet/test/common/ElementFindingTest.cs | 4 ++-- dotnet/test/common/FrameSwitchingTest.cs | 2 +- dotnet/test/common/JavascriptEnabledBrowserTest.cs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dotnet/test/common/ChildrenFindingTest.cs b/dotnet/test/common/ChildrenFindingTest.cs index bad207407a6fc..b8d0153272876 100644 --- a/dotnet/test/common/ChildrenFindingTest.cs +++ b/dotnet/test/common/ChildrenFindingTest.cs @@ -113,7 +113,7 @@ public void FindElementById() IWebElement element = driver.FindElement(By.Name("form2")); IWebElement child = element.FindElement(By.Id("2")); - Assert.That(child.GetAttribute("name"), Is.EqualTo("selectomatic")); + Assert.That(child.GetDomAttribute("name"), Is.EqualTo("selectomatic")); } @@ -177,7 +177,7 @@ public void FindElementByLinkText() IWebElement element = driver.FindElement(By.Name("div1")); IWebElement child = element.FindElement(By.LinkText("hello world")); - Assert.That(child.GetAttribute("name"), Is.EqualTo("link1")); + Assert.That(child.GetDomAttribute("name"), Is.EqualTo("link1")); } @@ -189,8 +189,8 @@ public void FindElementsByLinkText() ReadOnlyCollection elements = element.FindElements(By.LinkText("hello world")); Assert.That(elements, Has.Exactly(2).Items); - Assert.That(elements[0].GetAttribute("name"), Is.EqualTo("link1")); - Assert.That(elements[1].GetAttribute("name"), Is.EqualTo("link2")); + Assert.That(elements[0].GetDomAttribute("name"), Is.EqualTo("link1")); + Assert.That(elements[1].GetDomAttribute("name"), Is.EqualTo("link2")); } [Test] @@ -246,7 +246,7 @@ public void ShouldFindChildElementsByTagName() IWebElement element = parent.FindElement(By.TagName("a")); - Assert.That(element.GetAttribute("name"), Is.EqualTo("link1")); + Assert.That(element.GetDomAttribute("name"), Is.EqualTo("link1")); } diff --git a/dotnet/test/common/ElementFindingTest.cs b/dotnet/test/common/ElementFindingTest.cs index ef80108c602f3..563f4d4865f1c 100644 --- a/dotnet/test/common/ElementFindingTest.cs +++ b/dotnet/test/common/ElementFindingTest.cs @@ -151,7 +151,7 @@ public void ShouldBeAbleToFindAnElementThatDoesNotSupportTheNameProperty() { driver.Url = nestedPage; IWebElement element = driver.FindElement(By.Name("div1")); - Assert.That(element.GetAttribute("name"), Is.EqualTo("div1")); + Assert.That(element.GetDomAttribute("name"), Is.EqualTo("div1")); } // By.Name negative @@ -815,7 +815,7 @@ public void ShouldBeAbleToFindAHiddenElementsByName() { driver.Url = formsPage; IWebElement element = driver.FindElement(By.Name("hidden")); - Assert.That(element.GetAttribute("name"), Is.EqualTo("hidden")); + Assert.That(element.GetDomAttribute("name"), Is.EqualTo("hidden")); } [Test] diff --git a/dotnet/test/common/FrameSwitchingTest.cs b/dotnet/test/common/FrameSwitchingTest.cs index 4053b61046574..4896fd7a99215 100644 --- a/dotnet/test/common/FrameSwitchingTest.cs +++ b/dotnet/test/common/FrameSwitchingTest.cs @@ -101,7 +101,7 @@ public void ShouldBeAbleToSwitchToAFrameByItsName() { driver.Url = framesetPage; driver.SwitchTo().Frame("fourth"); - Assert.That(driver.FindElement(By.TagName("frame")).GetAttribute("name"), Is.EqualTo("child1")); + Assert.That(driver.FindElement(By.TagName("frame")).GetDomAttribute("name"), Is.EqualTo("child1")); } diff --git a/dotnet/test/common/JavascriptEnabledBrowserTest.cs b/dotnet/test/common/JavascriptEnabledBrowserTest.cs index 8075a95b46466..9dd27dfa92666 100644 --- a/dotnet/test/common/JavascriptEnabledBrowserTest.cs +++ b/dotnet/test/common/JavascriptEnabledBrowserTest.cs @@ -138,7 +138,7 @@ public void IfNoElementHasFocusTheActiveElementIsTheBody() IWebElement element = driver.SwitchTo().ActiveElement(); - Assert.That(element.GetAttribute("name"), Is.EqualTo("body")); + Assert.That(element.GetDomAttribute("name"), Is.EqualTo("body")); } [Test] From 6fc9b70678e989ac14703efdc968f54aec2801f7 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 15:04:39 +0300 Subject: [PATCH 04/35] class --- dotnet/test/common/ElementAttributeTest.cs | 4 ++-- dotnet/test/common/ElementFindingTest.cs | 12 ++++++------ dotnet/test/common/StaleElementReferenceTest.cs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 9b5399b7f98b6..9f2bacd4e1517 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -212,7 +212,7 @@ public void ShouldReturnValueOfClassAttributeOfAnElement() driver.Url = xhtmlTestPage; IWebElement heading = driver.FindElement(By.XPath("//h1")); - String className = heading.GetAttribute("class"); + String className = heading.GetDomAttribute("class"); Assert.That(className, Is.EqualTo("header")); } @@ -439,7 +439,7 @@ public void ShouldReturnValueOfClassAttributeOfAnElementAfterSwitchingIFrame() driver.SwitchTo().Frame("iframe1"); IWebElement wallace = driver.FindElement(By.XPath("//div[@id='wallace']")); - String className = wallace.GetAttribute("class"); + String className = wallace.GetDomAttribute("class"); Assert.That(className, Is.EqualTo("gromit")); } } diff --git a/dotnet/test/common/ElementFindingTest.cs b/dotnet/test/common/ElementFindingTest.cs index 563f4d4865f1c..98ed08cde1881 100644 --- a/dotnet/test/common/ElementFindingTest.cs +++ b/dotnet/test/common/ElementFindingTest.cs @@ -360,7 +360,7 @@ public void FindingASingleElementByAWeirdLookingClassName() driver.Url = xhtmlTestPage; String weird = "cls-!@#$%^&*"; IWebElement element = driver.FindElement(By.ClassName(weird)); - Assert.That(element.GetAttribute("class"), Is.EqualTo(weird)); + Assert.That(element.GetDomAttribute("class"), Is.EqualTo(weird)); } [Test] @@ -370,7 +370,7 @@ public void FindingMultipleElementsByAWeirdLookingClassName() String weird = "cls-!@#$%^&*"; ReadOnlyCollection elements = driver.FindElements(By.ClassName(weird)); Assert.That(elements, Has.Count.EqualTo(1)); - Assert.That(elements[0].GetAttribute("class"), Is.EqualTo(weird)); + Assert.That(elements[0].GetDomAttribute("class"), Is.EqualTo(weird)); } // By.XPath positive @@ -559,7 +559,7 @@ public void ShouldBeAbleToFindASingleElementByCssSelector() driver.Url = xhtmlTestPage; IWebElement element = driver.FindElement(By.CssSelector("div.content")); Assert.That(element.TagName.ToLower(), Is.EqualTo("div")); - Assert.That(element.GetAttribute("class"), Is.EqualTo("content")); + Assert.That(element.GetDomAttribute("class"), Is.EqualTo("content")); } [Test] @@ -576,7 +576,7 @@ public void ShouldBeAbleToFindASingleElementByCompoundCssSelector() driver.Url = xhtmlTestPage; IWebElement element = driver.FindElement(By.CssSelector("div.extraDiv, div.content")); Assert.That(element.TagName.ToLower(), Is.EqualTo("div")); - Assert.That(element.GetAttribute("class"), Is.EqualTo("content")); + Assert.That(element.GetDomAttribute("class"), Is.EqualTo("content")); } [Test] @@ -585,8 +585,8 @@ public void ShouldBeAbleToFindMultipleElementsByCompoundCssSelector() driver.Url = xhtmlTestPage; ReadOnlyCollection elements = driver.FindElements(By.CssSelector("div.extraDiv, div.content")); Assert.That(elements, Has.Count.GreaterThan(1)); - Assert.That(elements[0].GetAttribute("class"), Is.EqualTo("content")); - Assert.That(elements[1].GetAttribute("class"), Is.EqualTo("extraDiv")); + Assert.That(elements[0].GetDomAttribute("class"), Is.EqualTo("content")); + Assert.That(elements[1].GetDomAttribute("class"), Is.EqualTo("extraDiv")); } [Test] diff --git a/dotnet/test/common/StaleElementReferenceTest.cs b/dotnet/test/common/StaleElementReferenceTest.cs index ff3efe0301968..a7ed1e04b334a 100644 --- a/dotnet/test/common/StaleElementReferenceTest.cs +++ b/dotnet/test/common/StaleElementReferenceTest.cs @@ -49,7 +49,7 @@ public void ShouldNotCrashWhenQueryingTheAttributeOfAStaleElement() driver.Url = xhtmlTestPage; IWebElement heading = driver.FindElement(By.XPath("//h1")); driver.Url = simpleTestPage; - Assert.That(() => { string className = heading.GetAttribute("class"); }, Throws.InstanceOf()); + Assert.That(() => { string className = heading.GetDomAttribute("class"); }, Throws.InstanceOf()); } [Test] From b26630d83240e8a4bc53411b35aa333833ca58a9 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:09:15 +0300 Subject: [PATCH 05/35] readonly --- dotnet/test/common/ElementAttributeTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 9f2bacd4e1517..ca8696765a84b 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -242,12 +242,12 @@ public void ShouldTreatReadonlyAsAValue() driver.Url = formsPage; IWebElement element = driver.FindElement(By.Name("readonly")); - string readOnlyAttribute = element.GetAttribute("readonly"); + string readOnlyAttribute = element.GetDomAttribute("readonly"); Assert.That(readOnlyAttribute, Is.Not.Null); IWebElement textInput = driver.FindElement(By.Name("x")); - string notReadOnly = textInput.GetAttribute("readonly"); + string notReadOnly = textInput.GetDomAttribute("readonly"); Assert.That(notReadOnly, Is.Null); } From 81a234efa551e83cd9a84330e6e58486e56cb185 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:10:26 +0300 Subject: [PATCH 06/35] required --- dotnet/test/common/ElementAttributeTest.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index ca8696765a84b..825e30328bc7d 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -363,7 +363,7 @@ public void ShouldReturnNullForNonPresentBooleanAttributes() { driver.Url = booleanAttributes; IWebElement element1 = driver.FindElement(By.Id("working")); - Assert.That(element1.GetAttribute("required"), Is.Null); + Assert.That(element1.GetDomAttribute("required"), Is.Null); IWebElement element2 = driver.FindElement(By.Id("wallace")); Assert.That(element2.GetAttribute("nowrap"), Is.Null); } @@ -373,13 +373,13 @@ public void ShouldReturnTrueForPresentBooleanAttributes() { driver.Url = booleanAttributes; IWebElement element1 = driver.FindElement(By.Id("emailRequired")); - Assert.That(element1.GetAttribute("required"), Is.EqualTo("true")); + Assert.That(element1.GetDomAttribute("required"), Is.EqualTo("true")); IWebElement element2 = driver.FindElement(By.Id("emptyTextAreaRequired")); - Assert.That(element2.GetAttribute("required"), Is.EqualTo("true")); + Assert.That(element2.GetDomAttribute("required"), Is.EqualTo("true")); IWebElement element3 = driver.FindElement(By.Id("inputRequired")); - Assert.That(element3.GetAttribute("required"), Is.EqualTo("true")); + Assert.That(element3.GetDomAttribute("required"), Is.EqualTo("true")); IWebElement element4 = driver.FindElement(By.Id("textAreaRequired")); - Assert.That(element4.GetAttribute("required"), Is.EqualTo("true")); + Assert.That(element4.GetDomAttribute("required"), Is.EqualTo("true")); IWebElement element5 = driver.FindElement(By.Id("unwrappable")); Assert.That(element5.GetAttribute("nowrap"), Is.EqualTo("true")); } From acbf7b8b50ca6bc9ebf3a74e8cccebd0d786496d Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:11:29 +0300 Subject: [PATCH 07/35] rows --- dotnet/test/common/ElementAttributeTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 825e30328bc7d..1274c8851c270 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -268,7 +268,7 @@ public void ShouldGetNumericAtribute() { driver.Url = formsPage; IWebElement element = driver.FindElement(By.Id("withText")); - Assert.That(element.GetAttribute("rows"), Is.EqualTo("5")); + Assert.That(element.GetDomAttribute("rows"), Is.EqualTo("5")); } [Test] From 3cdb3588c746fac69adeb0f6fe508e08432296b2 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:13:11 +0300 Subject: [PATCH 08/35] nowrap --- dotnet/test/common/ElementAttributeTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 1274c8851c270..2f2f8c4a4724e 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -365,7 +365,7 @@ public void ShouldReturnNullForNonPresentBooleanAttributes() IWebElement element1 = driver.FindElement(By.Id("working")); Assert.That(element1.GetDomAttribute("required"), Is.Null); IWebElement element2 = driver.FindElement(By.Id("wallace")); - Assert.That(element2.GetAttribute("nowrap"), Is.Null); + Assert.That(element2.GetDomAttribute("nowrap"), Is.Null); } [Test] @@ -381,7 +381,7 @@ public void ShouldReturnTrueForPresentBooleanAttributes() IWebElement element4 = driver.FindElement(By.Id("textAreaRequired")); Assert.That(element4.GetDomAttribute("required"), Is.EqualTo("true")); IWebElement element5 = driver.FindElement(By.Id("unwrappable")); - Assert.That(element5.GetAttribute("nowrap"), Is.EqualTo("true")); + Assert.That(element5.GetDomAttribute("nowrap"), Is.EqualTo("true")); } [Test] From 59adbba7959339e828a9751a983f73f67493152a Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:15:15 +0300 Subject: [PATCH 09/35] multiple --- dotnet/src/support/UI/SelectElement.cs | 2 +- dotnet/test/common/ElementAttributeTest.cs | 10 +++++----- dotnet/test/common/GetMultipleAttributeTest.cs | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dotnet/src/support/UI/SelectElement.cs b/dotnet/src/support/UI/SelectElement.cs index 71b06a229245d..f9d7be809752c 100644 --- a/dotnet/src/support/UI/SelectElement.cs +++ b/dotnet/src/support/UI/SelectElement.cs @@ -54,7 +54,7 @@ public SelectElement(IWebElement element) this.element = element; // let check if it's a multiple - string attribute = element.GetAttribute("multiple"); + string attribute = element.GetDomAttribute("multiple"); this.IsMultiple = attribute != null && attribute.ToLowerInvariant() != "false"; } diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 2f2f8c4a4724e..bc18d7e2eb3bf 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -389,7 +389,7 @@ public void MultipleAttributeShouldBeNullWhenNotSet() { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithoutMultiple")); - Assert.That(element.GetAttribute("multiple"), Is.Null); + Assert.That(element.GetDomAttribute("multiple"), Is.Null); } [Test] @@ -397,7 +397,7 @@ public void MultipleAttributeShouldBeTrueWhenSet() { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithMultipleEqualsMultiple")); - Assert.That(element.GetAttribute("multiple"), Is.EqualTo("true")); + Assert.That(element.GetDomAttribute("multiple"), Is.EqualTo("true")); } [Test] @@ -405,7 +405,7 @@ public void MultipleAttributeShouldBeTrueWhenSelectHasMultipleWithValueAsBlank() { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithEmptyStringMultiple")); - Assert.That(element.GetAttribute("multiple"), Is.EqualTo("true")); + Assert.That(element.GetDomAttribute("multiple"), Is.EqualTo("true")); } [Test] @@ -413,7 +413,7 @@ public void MultipleAttributeShouldBeTrueWhenSelectHasMultipleWithoutAValue() { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithMultipleWithoutValue")); - Assert.That(element.GetAttribute("multiple"), Is.EqualTo("true")); + Assert.That(element.GetDomAttribute("multiple"), Is.EqualTo("true")); } [Test] @@ -421,7 +421,7 @@ public void MultipleAttributeShouldBeTrueWhenSelectHasMultipleWithValueAsSomethi { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithRandomMultipleValue")); - Assert.That(element.GetAttribute("multiple"), Is.EqualTo("true")); + Assert.That(element.GetDomAttribute("multiple"), Is.EqualTo("true")); } [Test] diff --git a/dotnet/test/common/GetMultipleAttributeTest.cs b/dotnet/test/common/GetMultipleAttributeTest.cs index 26cf57d4813c1..23f33fbaf1437 100644 --- a/dotnet/test/common/GetMultipleAttributeTest.cs +++ b/dotnet/test/common/GetMultipleAttributeTest.cs @@ -29,7 +29,7 @@ public void MultipleAttributeShouldBeNullWhenNotSet() { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithoutMultiple")); - Assert.That(element.GetAttribute("multiple"), Is.Null); + Assert.That(element.GetDomAttribute("multiple"), Is.Null); } [Test] @@ -37,7 +37,7 @@ public void MultipleAttributeShouldBeTrueWhenSet() { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithMultipleEqualsMultiple")); - Assert.That(element.GetAttribute("multiple"), Is.EqualTo("true")); + Assert.That(element.GetDomAttribute("multiple"), Is.EqualTo("true")); } [Test] @@ -45,7 +45,7 @@ public void MultipleAttributeShouldBeTrueWhenSelectHasMutilpeWithValueAsBlank() { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithEmptyStringMultiple")); - Assert.That(element.GetAttribute("multiple"), Is.EqualTo("true")); + Assert.That(element.GetDomAttribute("multiple"), Is.EqualTo("true")); } [Test] @@ -53,7 +53,7 @@ public void MultipleAttributeShouldBeTrueWhenSelectHasMutilpeWithoutAValue() { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithMultipleWithoutValue")); - Assert.That(element.GetAttribute("multiple"), Is.EqualTo("true")); + Assert.That(element.GetDomAttribute("multiple"), Is.EqualTo("true")); } [Test] @@ -61,7 +61,7 @@ public void MultipleAttributeShouldBeTrueWhenSelectHasMutilpeWithValueAsSomethin { driver.Url = selectPage; IWebElement element = driver.FindElement(By.Id("selectWithRandomMultipleValue")); - Assert.That(element.GetAttribute("multiple"), Is.EqualTo("true")); + Assert.That(element.GetDomAttribute("multiple"), Is.EqualTo("true")); } } } From c4d2cde577b141551204585d15cae2c17c43786c Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:17:04 +0300 Subject: [PATCH 10/35] innerHTML --- dotnet/test/common/ElementAttributeTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index bc18d7e2eb3bf..9e11e897c9548 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -232,7 +232,7 @@ public void ShouldReturnInnerHtml() { driver.Url = simpleTestPage; - string html = driver.FindElement(By.Id("wrappingtext")).GetAttribute("innerHTML"); + string html = driver.FindElement(By.Id("wrappingtext")).GetDomProperty("innerHTML"); Assert.That(html, Does.Contain("")); } From b5be6f22b72198ca846dead49196a342da82d715 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:18:05 +0300 Subject: [PATCH 11/35] textContent --- dotnet/test/common/ElementAttributeTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 9e11e897c9548..5f87a4f9628ce 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -258,7 +258,7 @@ public void ShouldReturnHiddenTextForTextContentAttribute() driver.Url = simpleTestPage; IWebElement element = driver.FindElement(By.Id("hiddenline")); - string textContent = element.GetAttribute("textContent"); + string textContent = element.GetDomProperty("textContent"); Assert.That(textContent, Is.EqualTo("A hidden line of text")); } From ba85145c217faa9acd33d11f9b61c45e07f2bfbb Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:19:38 +0300 Subject: [PATCH 12/35] index --- dotnet/src/support/UI/SelectElement.cs | 4 ++-- dotnet/test/common/ElementAttributeTest.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dotnet/src/support/UI/SelectElement.cs b/dotnet/src/support/UI/SelectElement.cs index f9d7be809752c..e8090105ca6b7 100644 --- a/dotnet/src/support/UI/SelectElement.cs +++ b/dotnet/src/support/UI/SelectElement.cs @@ -247,7 +247,7 @@ public void SelectByIndex(int index) foreach (IWebElement option in this.Options) { - if (option.GetAttribute("index") == match) + if (option.GetDomProperty("index") == match) { SetSelected(option, true); return; @@ -364,7 +364,7 @@ public void DeselectByIndex(int index) string match = index.ToString(CultureInfo.InvariantCulture); foreach (IWebElement option in this.Options) { - if (match == option.GetAttribute("index")) + if (match == option.GetDomProperty("index")) { SetSelected(option, false); return; diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 5f87a4f9628ce..2056364c6d62e 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -93,7 +93,7 @@ public void ShouldReturnTheValueOfTheIndexAttrbuteEvenIfItIsMissing() IWebElement multiSelect = driver.FindElement(By.Id("multi")); ReadOnlyCollection options = multiSelect.FindElements(By.TagName("option")); - Assert.That(options[1].GetAttribute("index"), Is.EqualTo("1")); + Assert.That(options[1].GetDomProperty("index"), Is.EqualTo("1")); } From 2b9d171f8a5f5aa0119051d2397ef832c4577af0 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:20:19 +0300 Subject: [PATCH 13/35] cheese --- dotnet/test/common/ElementAttributeTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 2056364c6d62e..887a86a39e0cd 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -33,7 +33,7 @@ public void ShouldReturnNullWhenGettingTheValueOfAnAttributeThatIsNotListed() { driver.Url = simpleTestPage; IWebElement head = driver.FindElement(By.XPath("/html")); - string attribute = head.GetAttribute("cheese"); + string attribute = head.GetDomAttribute("cheese"); Assert.That(attribute, Is.Null); } From dcea810190187c47364f369e76bcd057cbc1d180 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:22:27 +0300 Subject: [PATCH 14/35] colspan --- dotnet/test/common/ElementAttributeTest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 887a86a39e0cd..d01f3b1d68f38 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -280,19 +280,19 @@ public void CanReturnATextApproximationOfTheStyleAttribute() Assert.That(style.ToLower(), Does.Contain("background-color")); } + [Test] public void ShouldCorrectlyReportValueOfColspan() { driver.Url = tables; - System.Threading.Thread.Sleep(1000); IWebElement th1 = driver.FindElement(By.Id("th1")); IWebElement td2 = driver.FindElement(By.Id("td2")); Assert.That(th1.GetDomAttribute("id"), Is.EqualTo("th1"), "th1 id"); - Assert.That(th1.GetAttribute("colspan"), Is.EqualTo("3"), "th1 colspan should be 3"); + Assert.That(th1.GetDomAttribute("colspan"), Is.EqualTo("3"), "th1 colspan should be 3"); Assert.That(td2.GetDomAttribute("id"), Is.EqualTo("td2"), "td2 id"); - Assert.That(td2.GetAttribute("colspan"), Is.EqualTo("2"), "td2 colspan should be 2"); + Assert.That(td2.GetDomAttribute("colspan"), Is.EqualTo("2"), "td2 colspan should be 2"); } // This is a test-case re-creating issue 900. From 5d050fd7724f5b3de9a2b9283f045acc7e112eb2 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:24:01 +0300 Subject: [PATCH 15/35] style --- dotnet/test/common/ElementAttributeTest.cs | 4 ++-- dotnet/test/ie/IeSpecificTests.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index d01f3b1d68f38..fb5288f93250a 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -70,7 +70,7 @@ public void ShouldReturnEmptyAttributeValuesWhenPresentAndTheValueIsActuallyEmpt { driver.Url = simpleTestPage; IWebElement body = driver.FindElement(By.XPath("//body")); - Assert.That(body.GetAttribute("style"), Is.Empty); + Assert.That(body.GetDomAttribute("style"), Is.Empty); } [Test] @@ -275,7 +275,7 @@ public void ShouldGetNumericAtribute() public void CanReturnATextApproximationOfTheStyleAttribute() { driver.Url = javascriptPage; - string style = driver.FindElement(By.Id("red-item")).GetAttribute("style"); + string style = driver.FindElement(By.Id("red-item")).GetDomAttribute("style"); Assert.That(style.ToLower(), Does.Contain("background-color")); } diff --git a/dotnet/test/ie/IeSpecificTests.cs b/dotnet/test/ie/IeSpecificTests.cs index 0158c19158f98..2576e583052cb 100644 --- a/dotnet/test/ie/IeSpecificTests.cs +++ b/dotnet/test/ie/IeSpecificTests.cs @@ -209,7 +209,7 @@ public void ShouldPropagateSessionCookies() System.Threading.Thread.Sleep(2000); string startWindow = driver.CurrentWindowHandle; driver.SwitchTo().Window("cookiedestwindow"); - string bodyStyle = driver.FindElement(By.TagName("body")).GetAttribute("style"); + string bodyStyle = driver.FindElement(By.TagName("body")).GetDomAttribute("style"); driver.Close(); driver.SwitchTo().Window(startWindow); Assert.That(bodyStyle, Does.Contain("BACKGROUND-COLOR: #80ffff").Or.Contain("background-color: rgb(128, 255, 255)")); From a73eec9c9c54e096e3073b4a449cb0cb163c1486 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:26:34 +0300 Subject: [PATCH 16/35] disabled --- dotnet/test/common/ElementAttributeTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index fb5288f93250a..d1dcce402af0b 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -78,11 +78,11 @@ public void ShouldReturnTheValueOfTheDisabledAttributeAsNullIfNotSet() { driver.Url = formsPage; IWebElement inputElement = driver.FindElement(By.XPath("//input[@id='working']")); - Assert.That(inputElement.GetAttribute("disabled"), Is.Null); + Assert.That(inputElement.GetDomAttribute("disabled"), Is.Null); Assert.That(inputElement.Enabled, "Element is not enabled"); IWebElement pElement = driver.FindElement(By.Id("peas")); - Assert.That(inputElement.GetAttribute("disabled"), Is.Null); + Assert.That(inputElement.GetDomAttribute("disabled"), Is.Null); Assert.That(inputElement.Enabled, "Element is not enabled"); } From 2b74ae6861ecc59e1537819279e1562f60eb1ac3 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:28:05 +0300 Subject: [PATCH 17/35] onclick --- dotnet/test/common/ElementAttributeTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index d1dcce402af0b..3133f518ebf01 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -303,7 +303,7 @@ public void ShouldReturnValueOfOnClickAttribute() IWebElement mouseclickDiv = driver.FindElement(By.Id("mouseclick")); - string onClickValue = mouseclickDiv.GetAttribute("onclick"); + string onClickValue = mouseclickDiv.GetDomAttribute("onclick"); string expectedOnClickValue = "displayMessage('mouse click');"; List acceptableOnClickValues = new List(); acceptableOnClickValues.Add("javascript:" + expectedOnClickValue); @@ -312,7 +312,7 @@ public void ShouldReturnValueOfOnClickAttribute() Assert.That(acceptableOnClickValues, Contains.Item(onClickValue)); IWebElement mousedownDiv = driver.FindElement(By.Id("mousedown")); - Assert.That(mousedownDiv.GetAttribute("onclick"), Is.Null); + Assert.That(mousedownDiv.GetDomAttribute("onclick"), Is.Null); } [Test] From bd26d882ebe5e7921a99bc08b0a3f26f28c0c0f7 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:28:50 +0300 Subject: [PATCH 18/35] transform --- dotnet/test/common/ElementAttributeTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 3133f518ebf01..a308a72c71af6 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -325,7 +325,7 @@ public void GetAttributeDoesNotReturnAnObjectForSvgProperties() driver.Url = svgPage; IWebElement svgElement = driver.FindElement(By.Id("rotate")); - Assert.That(svgElement.GetAttribute("transform"), Is.EqualTo("rotate(30)")); + Assert.That(svgElement.GetDomAttribute("transform"), Is.EqualTo("rotate(30)")); } [Test] From 6b46e27393bf7b9003a81f6f1a5bc66f2b6a1a2b Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:29:48 +0300 Subject: [PATCH 19/35] dynamicProperty --- dotnet/test/common/ElementAttributeTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index a308a72c71af6..452324b7c5e9a 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -429,7 +429,7 @@ public void GetAttributeOfUserDefinedProperty() { driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("userDefinedProperty.html"); IWebElement element = driver.FindElement(By.Id("d")); - Assert.That(element.GetAttribute("dynamicProperty"), Is.EqualTo("sampleValue")); + Assert.That(element.GetDomProperty("dynamicProperty"), Is.EqualTo("sampleValue")); } [Test] From f6aa829f574881bfb54c06f562ff787beac16e7a Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:45:51 +0300 Subject: [PATCH 20/35] fill --- dotnet/test/common/SvgDocumentTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dotnet/test/common/SvgDocumentTest.cs b/dotnet/test/common/SvgDocumentTest.cs index 5a777d920492a..b9a2b7d0f6856 100644 --- a/dotnet/test/common/SvgDocumentTest.cs +++ b/dotnet/test/common/SvgDocumentTest.cs @@ -38,9 +38,9 @@ public void ClickOnSvgElement() driver.Url = svgTestPage; IWebElement rect = driver.FindElement(By.Id("rect")); - Assert.That(rect.GetAttribute("fill"), Is.EqualTo("blue")); + Assert.That(rect.GetDomAttribute("fill"), Is.EqualTo("blue")); rect.Click(); - Assert.That(rect.GetAttribute("fill"), Is.EqualTo("green")); + Assert.That(rect.GetDomAttribute("fill"), Is.EqualTo("green")); } [Test] @@ -54,9 +54,9 @@ public void ExecuteScriptInSvgDocument() driver.Url = svgTestPage; IWebElement rect = driver.FindElement(By.Id("rect")); - Assert.That(rect.GetAttribute("fill"), Is.EqualTo("blue")); + Assert.That(rect.GetDomAttribute("fill"), Is.EqualTo("blue")); ((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById('rect').setAttribute('fill', 'yellow');"); - Assert.That(rect.GetAttribute("fill"), Is.EqualTo("yellow")); + Assert.That(rect.GetDomAttribute("fill"), Is.EqualTo("yellow")); } } } From 7f042489ac0c06db6ab5228fbb98f3c99889fb7c Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:47:05 +0300 Subject: [PATCH 21/35] type --- dotnet/src/webdriver/WebElement.cs | 2 +- dotnet/test/common/ShadowRootHandlingTest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/src/webdriver/WebElement.cs b/dotnet/src/webdriver/WebElement.cs index b3e4356ca55b1..c5bc26cd98820 100644 --- a/dotnet/src/webdriver/WebElement.cs +++ b/dotnet/src/webdriver/WebElement.cs @@ -618,7 +618,7 @@ public virtual void SendKeys(string text) /// Thrown when the target element is no longer valid in the document DOM. public virtual void Submit() { - string elementType = this.GetAttribute("type"); + string elementType = this.GetDomAttribute("type"); if (elementType != null && elementType == "submit") { this.Click(); diff --git a/dotnet/test/common/ShadowRootHandlingTest.cs b/dotnet/test/common/ShadowRootHandlingTest.cs index 7fa25654dd10f..164929a138afd 100644 --- a/dotnet/test/common/ShadowRootHandlingTest.cs +++ b/dotnet/test/common/ShadowRootHandlingTest.cs @@ -43,7 +43,7 @@ public void ShouldFindElementUnderShadowRoot() IWebElement element = driver.FindElement(By.CssSelector("custom-checkbox-element")); ISearchContext shadowRoot = element.GetShadowRoot(); IWebElement elementInShadow = shadowRoot.FindElement(By.CssSelector("input")); - Assert.That(elementInShadow.GetAttribute("type"), Is.EqualTo("checkbox"), "Did not find element in shadow root"); + Assert.That(elementInShadow.GetDomAttribute("type"), Is.EqualTo("checkbox"), "Did not find element in shadow root"); } [Test] From 120cc8bc0ea8667de252d8141c92d27d2ce763a3 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:49:01 +0300 Subject: [PATCH 22/35] href --- dotnet/test/common/ElementAttributeTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 452324b7c5e9a..3fbf0d8b27eaa 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -60,7 +60,7 @@ public void ShouldReturnAnAbsoluteUrlWhenGettingHrefAttributeOfAValidAnchorTag() { driver.Url = simpleTestPage; IWebElement img = driver.FindElement(By.Id("validAnchorTag")); - string attribute = img.GetAttribute("href"); + string attribute = img.GetDomProperty("href"); Assert.That(attribute, Is.EqualTo(EnvironmentManager.Instance.UrlBuilder.WhereIs("icon.gif"))); } From bcde363ea857e6bb1408c7b028d8eafd809823b2 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:53:10 +0300 Subject: [PATCH 23/35] Mocks for multiple --- dotnet/test/support/UI/SelectTests.cs | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/dotnet/test/support/UI/SelectTests.cs b/dotnet/test/support/UI/SelectTests.cs index d4966e29aea6c..9ad8c6618f7d6 100644 --- a/dotnet/test/support/UI/SelectTests.cs +++ b/dotnet/test/support/UI/SelectTests.cs @@ -50,7 +50,7 @@ public void ThrowUnexpectedTagNameExceptionWhenNotSelectTag() public void CanCreateNewInstanceOfSelectWithNormalSelectElement() { webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns((string)null); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns((string)null); Assert.That(new SelectElement(webElement.Object).IsMultiple, Is.False); } @@ -59,7 +59,7 @@ public void CanCreateNewInstanceOfSelectWithNormalSelectElement() public void CanCreateNewInstanceOfSelectWithMultipleSelectElement() { webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); Assert.That(new SelectElement(webElement.Object).IsMultiple, Is.True); } @@ -69,7 +69,7 @@ public void CanGetListOfOptions() { IList options = new List(); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)); Assert.That(new SelectElement(webElement.Object).Options, Is.EqualTo(options)); @@ -85,7 +85,7 @@ public void CanGetSingleSelectedOption() options.Add(selected.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); notSelected.SetupGet(_ => _.Selected).Returns(false); selected.SetupGet(_ => _.Selected).Returns(true); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)).Verifiable(); @@ -107,7 +107,7 @@ public void CanGetAllSelectedOptions() options.Add(notSelected.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); notSelected.SetupGet(_ => _.Selected).Returns(false); selected.SetupGet(_ => _.Selected).Returns(true); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)).Verifiable(); @@ -128,7 +128,7 @@ public void CanSetSingleOptionSelectedByText() options.Add(option1.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); option1.Setup(_ => _.Click()); @@ -148,7 +148,7 @@ public void CanSetSingleOptionSelectedByValue() options.Add(option1.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns((string)null); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns((string)null); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); option1.Setup(_ => _.Click()); @@ -168,7 +168,7 @@ public void CanSetSingleOptionSelectedByIndex() options.Add(option1.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns((string)null); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns((string)null); option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("2"); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); @@ -192,7 +192,7 @@ public void CanSetMultipleOptionSelectedByText() options.Add(option2.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); option1.Setup(_ => _.Click()); @@ -219,7 +219,7 @@ public void CanSetMultipleOptionSelectedByValue() options.Add(option2.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); option1.Setup(_ => _.Click()); @@ -246,7 +246,7 @@ public void CanSetMultipleOptionSelectedByIndex() options.Add(option2.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("1"); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); @@ -275,7 +275,7 @@ public void CanDeselectSingleOptionSelectedByText() options.Add(option1.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)).Verifiable(); @@ -294,7 +294,7 @@ public void CanDeselectSingleOptionSelectedByValue() options.Add(option1.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)).Verifiable(); @@ -313,7 +313,7 @@ public void CanDeselectSingleOptionSelectedByIndex() options.Add(option1.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("2"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); @@ -336,7 +336,7 @@ public void CanDeselectMultipleOptionSelectedByText() options.Add(option2.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); option2.SetupGet(_ => _.Selected).Returns(true); @@ -356,7 +356,7 @@ public void CanDeselectMultipleOptionSelectedByValue() options.Add(option2.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); option2.SetupGet(_ => _.Selected).Returns(true); @@ -381,7 +381,7 @@ public void CanDeselectMultipleOptionSelectedByIndex() options.Add(option2.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("1"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); @@ -409,7 +409,7 @@ public void SelectedOptionPropertyShouldThrowExceptionWhenNoOptionSelected() options.Add(notSelected.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); notSelected.SetupGet(_ => _.Selected).Returns(false); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)).Verifiable(); From 27e623c1f230801e1182dfef97aeed508ecdec8b Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 22:38:17 +0300 Subject: [PATCH 24/35] src --- dotnet/test/common/ElementAttributeTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 3fbf0d8b27eaa..9fb7c40ba8332 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -42,7 +42,7 @@ public void ShouldReturnNullWhenGettingSrcAttributeOfInvalidImgTag() { driver.Url = simpleTestPage; IWebElement img = driver.FindElement(By.Id("invalidImgTag")); - string attribute = img.GetAttribute("src"); + string attribute = img.GetDomProperty("src"); Assert.That(attribute, Is.Null); } @@ -51,7 +51,7 @@ public void ShouldReturnAnAbsoluteUrlWhenGettingSrcAttributeOfAValidImgTag() { driver.Url = simpleTestPage; IWebElement img = driver.FindElement(By.Id("validImgTag")); - string attribute = img.GetAttribute("src"); + string attribute = img.GetDomProperty("src"); Assert.That(attribute, Is.EqualTo(EnvironmentManager.Instance.UrlBuilder.WhereIs("icon.gif"))); } From afebc9bb668856e735f2a0dbb914254d127e6bd6 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 7 Dec 2024 23:26:23 +0300 Subject: [PATCH 25/35] checked --- dotnet/test/common/ElementAttributeTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 9fb7c40ba8332..dc1d73697c19a 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -169,9 +169,9 @@ public void ShouldReturnTheValueOfCheckedForACheckboxOnlyIfItIsChecked() { driver.Url = formsPage; IWebElement checkbox = driver.FindElement(By.XPath("//input[@id='checky']")); - Assert.That(checkbox.GetAttribute("checked"), Is.Null); + Assert.That(checkbox.GetDomProperty("checked"), Is.EqualTo("False")); checkbox.Click(); - Assert.That(checkbox.GetAttribute("checked"), Is.EqualTo("true")); + Assert.That(checkbox.GetDomProperty("checked"), Is.EqualTo("True")); } [Test] From 0b132709776f865683af06533eff3eb284133261 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:20:05 +0300 Subject: [PATCH 26/35] selected --- dotnet/test/common/ElementAttributeTest.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index dc1d73697c19a..24d4069e12750 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -182,14 +182,14 @@ public void ShouldOnlyReturnTheValueOfSelectedForRadioButtonsIfItIsSet() IWebElement initiallyNotSelected = driver.FindElement(By.Id("peas")); IWebElement initiallySelected = driver.FindElement(By.Id("cheese_and_peas")); - Assert.That(neverSelected.GetAttribute("selected"), Is.Null, "false"); - Assert.That(initiallyNotSelected.GetAttribute("selected"), Is.Null, "false"); - Assert.That(initiallySelected.GetAttribute("selected"), Is.EqualTo("true"), "true"); + Assert.That(neverSelected.GetDomProperty("checked"), Is.EqualTo("False")); + Assert.That(initiallyNotSelected.GetDomProperty("checked"), Is.EqualTo("False")); + Assert.That(initiallySelected.GetDomProperty("checked"), Is.EqualTo("True")); initiallyNotSelected.Click(); - Assert.That(neverSelected.GetAttribute("selected"), Is.Null); - Assert.That(initiallyNotSelected.GetAttribute("selected"), Is.EqualTo("true")); - Assert.That(initiallySelected.GetAttribute("selected"), Is.Null); + Assert.That(neverSelected.GetDomProperty("checked"), Is.EqualTo("False")); + Assert.That(initiallyNotSelected.GetDomProperty("checked"), Is.EqualTo("True")); + Assert.That(initiallySelected.GetDomProperty("checked"), Is.EqualTo("False")); } [Test] @@ -202,8 +202,8 @@ public void ShouldReturnTheValueOfSelectedForOptionsOnlyIfTheyAreSelected() IWebElement two = options[1]; Assert.That(one.Selected, Is.True); Assert.That(two.Selected, Is.False); - Assert.That(one.GetAttribute("selected"), Is.EqualTo("true")); - Assert.That(two.GetAttribute("selected"), Is.Null); + Assert.That(one.GetDomProperty("checked"), Is.EqualTo("True")); + Assert.That(two.GetDomProperty("checked"), Is.EqualTo("False")); } [Test] From ba22c434e392bc01b5bc680e0d84ccf4fd174f79 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:36:20 +0300 Subject: [PATCH 27/35] Revert "selected" - there is webdriver spec for selected This reverts commit 0b132709776f865683af06533eff3eb284133261. --- dotnet/test/common/ElementAttributeTest.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index 24d4069e12750..dc1d73697c19a 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -182,14 +182,14 @@ public void ShouldOnlyReturnTheValueOfSelectedForRadioButtonsIfItIsSet() IWebElement initiallyNotSelected = driver.FindElement(By.Id("peas")); IWebElement initiallySelected = driver.FindElement(By.Id("cheese_and_peas")); - Assert.That(neverSelected.GetDomProperty("checked"), Is.EqualTo("False")); - Assert.That(initiallyNotSelected.GetDomProperty("checked"), Is.EqualTo("False")); - Assert.That(initiallySelected.GetDomProperty("checked"), Is.EqualTo("True")); + Assert.That(neverSelected.GetAttribute("selected"), Is.Null, "false"); + Assert.That(initiallyNotSelected.GetAttribute("selected"), Is.Null, "false"); + Assert.That(initiallySelected.GetAttribute("selected"), Is.EqualTo("true"), "true"); initiallyNotSelected.Click(); - Assert.That(neverSelected.GetDomProperty("checked"), Is.EqualTo("False")); - Assert.That(initiallyNotSelected.GetDomProperty("checked"), Is.EqualTo("True")); - Assert.That(initiallySelected.GetDomProperty("checked"), Is.EqualTo("False")); + Assert.That(neverSelected.GetAttribute("selected"), Is.Null); + Assert.That(initiallyNotSelected.GetAttribute("selected"), Is.EqualTo("true")); + Assert.That(initiallySelected.GetAttribute("selected"), Is.Null); } [Test] @@ -202,8 +202,8 @@ public void ShouldReturnTheValueOfSelectedForOptionsOnlyIfTheyAreSelected() IWebElement two = options[1]; Assert.That(one.Selected, Is.True); Assert.That(two.Selected, Is.False); - Assert.That(one.GetDomProperty("checked"), Is.EqualTo("True")); - Assert.That(two.GetDomProperty("checked"), Is.EqualTo("False")); + Assert.That(one.GetAttribute("selected"), Is.EqualTo("true")); + Assert.That(two.GetAttribute("selected"), Is.Null); } [Test] From 2524f0a98d91f89615836533d8e2a8a073e9fadb Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:44:31 +0300 Subject: [PATCH 28/35] Use native `Selected` property instead of attr/prop --- dotnet/test/common/ElementAttributeTest.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index dc1d73697c19a..ca3349bb98f64 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -182,14 +182,14 @@ public void ShouldOnlyReturnTheValueOfSelectedForRadioButtonsIfItIsSet() IWebElement initiallyNotSelected = driver.FindElement(By.Id("peas")); IWebElement initiallySelected = driver.FindElement(By.Id("cheese_and_peas")); - Assert.That(neverSelected.GetAttribute("selected"), Is.Null, "false"); - Assert.That(initiallyNotSelected.GetAttribute("selected"), Is.Null, "false"); - Assert.That(initiallySelected.GetAttribute("selected"), Is.EqualTo("true"), "true"); + Assert.That(neverSelected.Selected, Is.False); + Assert.That(initiallyNotSelected.Selected, Is.False); + Assert.That(initiallySelected.Selected, Is.True); initiallyNotSelected.Click(); - Assert.That(neverSelected.GetAttribute("selected"), Is.Null); - Assert.That(initiallyNotSelected.GetAttribute("selected"), Is.EqualTo("true")); - Assert.That(initiallySelected.GetAttribute("selected"), Is.Null); + Assert.That(neverSelected.Selected, Is.False); + Assert.That(initiallyNotSelected.Selected, Is.True); + Assert.That(initiallySelected.Selected, Is.False); } [Test] @@ -202,8 +202,6 @@ public void ShouldReturnTheValueOfSelectedForOptionsOnlyIfTheyAreSelected() IWebElement two = options[1]; Assert.That(one.Selected, Is.True); Assert.That(two.Selected, Is.False); - Assert.That(one.GetAttribute("selected"), Is.EqualTo("true")); - Assert.That(two.GetAttribute("selected"), Is.Null); } [Test] From 71a306acfff415456566a0598a754ff24e7b914e Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:58:18 +0300 Subject: [PATCH 29/35] Fix ShouldReturnNullWhenGettingSrcAttributeOfInvalidImgTag test --- dotnet/test/common/ElementAttributeTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index ca3349bb98f64..d6be1a3510106 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -42,7 +42,7 @@ public void ShouldReturnNullWhenGettingSrcAttributeOfInvalidImgTag() { driver.Url = simpleTestPage; IWebElement img = driver.FindElement(By.Id("invalidImgTag")); - string attribute = img.GetDomProperty("src"); + string attribute = img.GetDomAttribute("src"); Assert.That(attribute, Is.Null); } From ba2b79801e89e944c21ce50098d2df17907763a9 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 8 Dec 2024 01:08:32 +0300 Subject: [PATCH 30/35] Finally in support UI --- dotnet/test/support/UI/SelectTests.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dotnet/test/support/UI/SelectTests.cs b/dotnet/test/support/UI/SelectTests.cs index 9ad8c6618f7d6..b636e9557d273 100644 --- a/dotnet/test/support/UI/SelectTests.cs +++ b/dotnet/test/support/UI/SelectTests.cs @@ -169,7 +169,7 @@ public void CanSetSingleOptionSelectedByIndex() webElement.SetupGet(_ => _.TagName).Returns("select"); webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns((string)null); - option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("2"); + option1.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("2"); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); option1.Setup(_ => _.Click()); @@ -178,7 +178,7 @@ public void CanSetSingleOptionSelectedByIndex() new SelectElement(webElement.Object).SelectByIndex(2); option1.Verify(_ => _.Selected, Times.Once); option1.Verify(_ => _.Click(), Times.Once); - option1.Verify(_ => _.GetAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); } @@ -247,11 +247,11 @@ public void CanSetMultipleOptionSelectedByIndex() webElement.SetupGet(_ => _.TagName).Returns("select"); webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); - option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("1"); + option1.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("1"); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); option1.Setup(_ => _.Click()); - option2.Setup(_ => _.GetAttribute(It.IsAny())).Returns("2"); + option2.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("2"); option2.SetupGet(_ => _.Selected).Returns(false); option2.SetupGet(_ => _.Enabled).Returns(true); option2.Setup(_ => _.Click()); @@ -260,10 +260,10 @@ public void CanSetMultipleOptionSelectedByIndex() new SelectElement(webElement.Object).SelectByIndex(2); option1.Verify(_ => _.Selected, Times.Never); option1.Verify(_ => _.Click(), Times.Never); - option1.Verify(_ => _.GetAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); option2.Verify(_ => _.Selected, Times.Once); option2.Verify(_ => _.Click(), Times.Once); - option2.Verify(_ => _.GetAttribute(It.IsAny()), Times.Once); + option2.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); } @@ -314,13 +314,13 @@ public void CanDeselectSingleOptionSelectedByIndex() webElement.SetupGet(_ => _.TagName).Returns("select"); webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); - option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("2"); + option1.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("2"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)).Verifiable(); new SelectElement(webElement.Object).DeselectByIndex(2); - option1.Verify(_ => _.GetAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); option1.Verify(_ => _.Selected, Times.Once); option1.Verify(_ => _.Click(), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); @@ -382,19 +382,19 @@ public void CanDeselectMultipleOptionSelectedByIndex() webElement.SetupGet(_ => _.TagName).Returns("select"); webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); - option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("1"); + option1.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("1"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); - option2.Setup(_ => _.GetAttribute(It.IsAny())).Returns("2"); + option2.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("2"); option2.SetupGet(_ => _.Selected).Returns(true); option2.Setup(_ => _.Click()); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)).Verifiable(); new SelectElement(webElement.Object).DeselectByIndex(2); - option1.Verify(_ => _.GetAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); option1.Verify(_ => _.Selected, Times.Never); option1.Verify(_ => _.Click(), Times.Never); - option2.Verify(_ => _.GetAttribute(It.IsAny()), Times.Once); + option2.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); option2.Verify(_ => _.Selected, Times.Once); option2.Verify(_ => _.Click(), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); From d6eb0139b68e0f41a34523efe924e3729cae3155 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 8 Dec 2024 01:24:10 +0300 Subject: [PATCH 31/35] Fix select in support package --- dotnet/src/support/UI/SelectElement.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/src/support/UI/SelectElement.cs b/dotnet/src/support/UI/SelectElement.cs index e8090105ca6b7..467cf5c68e3bc 100644 --- a/dotnet/src/support/UI/SelectElement.cs +++ b/dotnet/src/support/UI/SelectElement.cs @@ -247,7 +247,7 @@ public void SelectByIndex(int index) foreach (IWebElement option in this.Options) { - if (option.GetDomProperty("index") == match) + if (option.GetDomAttribute("index") == match) { SetSelected(option, true); return; @@ -364,7 +364,7 @@ public void DeselectByIndex(int index) string match = index.ToString(CultureInfo.InvariantCulture); foreach (IWebElement option in this.Options) { - if (match == option.GetDomProperty("index")) + if (match == option.GetDomAttribute("index")) { SetSelected(option, false); return; From 855f06a6b59d1fa2d99c0ef39e6a4d3fc213ac8a Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 8 Dec 2024 13:36:47 +0300 Subject: [PATCH 32/35] Fix SelectTests via getting index as property --- dotnet/src/support/UI/SelectElement.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/src/support/UI/SelectElement.cs b/dotnet/src/support/UI/SelectElement.cs index 467cf5c68e3bc..e8090105ca6b7 100644 --- a/dotnet/src/support/UI/SelectElement.cs +++ b/dotnet/src/support/UI/SelectElement.cs @@ -247,7 +247,7 @@ public void SelectByIndex(int index) foreach (IWebElement option in this.Options) { - if (option.GetDomAttribute("index") == match) + if (option.GetDomProperty("index") == match) { SetSelected(option, true); return; @@ -364,7 +364,7 @@ public void DeselectByIndex(int index) string match = index.ToString(CultureInfo.InvariantCulture); foreach (IWebElement option in this.Options) { - if (match == option.GetDomAttribute("index")) + if (match == option.GetDomProperty("index")) { SetSelected(option, false); return; From 4dbf305427f96e1a445af896284e8591f57e267f Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 8 Dec 2024 13:52:45 +0300 Subject: [PATCH 33/35] Fix mocks for select index --- dotnet/test/support/UI/SelectTests.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dotnet/test/support/UI/SelectTests.cs b/dotnet/test/support/UI/SelectTests.cs index b636e9557d273..846e3fd22fdbe 100644 --- a/dotnet/test/support/UI/SelectTests.cs +++ b/dotnet/test/support/UI/SelectTests.cs @@ -169,7 +169,7 @@ public void CanSetSingleOptionSelectedByIndex() webElement.SetupGet(_ => _.TagName).Returns("select"); webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns((string)null); - option1.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("2"); + option1.Setup(_ => _.GetDomProperty(It.IsAny())).Returns("2"); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); option1.Setup(_ => _.Click()); @@ -178,7 +178,7 @@ public void CanSetSingleOptionSelectedByIndex() new SelectElement(webElement.Object).SelectByIndex(2); option1.Verify(_ => _.Selected, Times.Once); option1.Verify(_ => _.Click(), Times.Once); - option1.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); } @@ -247,11 +247,11 @@ public void CanSetMultipleOptionSelectedByIndex() webElement.SetupGet(_ => _.TagName).Returns("select"); webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); - option1.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("1"); + option1.Setup(_ => _.GetDomProperty(It.IsAny())).Returns("1"); option1.SetupGet(_ => _.Selected).Returns(false); option1.SetupGet(_ => _.Enabled).Returns(true); option1.Setup(_ => _.Click()); - option2.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("2"); + option2.Setup(_ => _.GetDomProperty(It.IsAny())).Returns("2"); option2.SetupGet(_ => _.Selected).Returns(false); option2.SetupGet(_ => _.Enabled).Returns(true); option2.Setup(_ => _.Click()); @@ -260,10 +260,10 @@ public void CanSetMultipleOptionSelectedByIndex() new SelectElement(webElement.Object).SelectByIndex(2); option1.Verify(_ => _.Selected, Times.Never); option1.Verify(_ => _.Click(), Times.Never); - option1.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); option2.Verify(_ => _.Selected, Times.Once); option2.Verify(_ => _.Click(), Times.Once); - option2.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); + option2.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); } @@ -314,13 +314,13 @@ public void CanDeselectSingleOptionSelectedByIndex() webElement.SetupGet(_ => _.TagName).Returns("select"); webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); - option1.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("2"); + option1.Setup(_ => _.GetDomProperty(It.IsAny())).Returns("2"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)).Verifiable(); new SelectElement(webElement.Object).DeselectByIndex(2); - option1.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); option1.Verify(_ => _.Selected, Times.Once); option1.Verify(_ => _.Click(), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); @@ -382,19 +382,19 @@ public void CanDeselectMultipleOptionSelectedByIndex() webElement.SetupGet(_ => _.TagName).Returns("select"); webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); - option1.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("1"); + option1.Setup(_ => _.GetDomProperty(It.IsAny())).Returns("1"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); - option2.Setup(_ => _.GetDomAttribute(It.IsAny())).Returns("2"); + option2.Setup(_ => _.GetDomProperty(It.IsAny())).Returns("2"); option2.SetupGet(_ => _.Selected).Returns(true); option2.Setup(_ => _.Click()); webElement.Setup(_ => _.FindElements(It.IsAny())).Returns(new ReadOnlyCollection(options)).Verifiable(); new SelectElement(webElement.Object).DeselectByIndex(2); - option1.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); option1.Verify(_ => _.Selected, Times.Never); option1.Verify(_ => _.Click(), Times.Never); - option2.Verify(_ => _.GetDomAttribute(It.IsAny()), Times.Once); + option2.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); option2.Verify(_ => _.Selected, Times.Once); option2.Verify(_ => _.Click(), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); From 44439132cfa1aad4c16c34194f22b6c7844c294e Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 8 Dec 2024 14:31:08 +0300 Subject: [PATCH 34/35] Align ShouldReturnEmptyStringForPresentBooleanAttributes test with java implementation --- dotnet/test/common/ElementAttributeTest.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dotnet/test/common/ElementAttributeTest.cs b/dotnet/test/common/ElementAttributeTest.cs index d6be1a3510106..ca31f46292f64 100644 --- a/dotnet/test/common/ElementAttributeTest.cs +++ b/dotnet/test/common/ElementAttributeTest.cs @@ -367,19 +367,22 @@ public void ShouldReturnNullForNonPresentBooleanAttributes() } [Test] - public void ShouldReturnTrueForPresentBooleanAttributes() + [IgnoreBrowser(Browser.Chrome)] + [IgnoreBrowser(Browser.Edge)] + [IgnoreBrowser(Browser.Firefox)] + public void ShouldReturnEmptyStringForPresentBooleanAttributes() { driver.Url = booleanAttributes; IWebElement element1 = driver.FindElement(By.Id("emailRequired")); - Assert.That(element1.GetDomAttribute("required"), Is.EqualTo("true")); + Assert.That(element1.GetDomAttribute("required"), Is.Empty); IWebElement element2 = driver.FindElement(By.Id("emptyTextAreaRequired")); - Assert.That(element2.GetDomAttribute("required"), Is.EqualTo("true")); + Assert.That(element2.GetDomAttribute("required"), Is.Empty); IWebElement element3 = driver.FindElement(By.Id("inputRequired")); - Assert.That(element3.GetDomAttribute("required"), Is.EqualTo("true")); + Assert.That(element3.GetDomAttribute("required"), Is.Empty); IWebElement element4 = driver.FindElement(By.Id("textAreaRequired")); - Assert.That(element4.GetDomAttribute("required"), Is.EqualTo("true")); + Assert.That(element4.GetDomAttribute("required"), Is.Empty); IWebElement element5 = driver.FindElement(By.Id("unwrappable")); - Assert.That(element5.GetDomAttribute("nowrap"), Is.EqualTo("true")); + Assert.That(element5.GetDomAttribute("nowrap"), Is.Empty); } [Test] From 3ec2724fe5db3edb14b5f9257c81eabd9e45830c Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Fri, 13 Dec 2024 01:21:33 +0300 Subject: [PATCH 35/35] Update FormHandlingTests.cs --- dotnet/test/common/FormHandlingTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/test/common/FormHandlingTests.cs b/dotnet/test/common/FormHandlingTests.cs index 0fc110a29fd63..33b177fc2060b 100644 --- a/dotnet/test/common/FormHandlingTests.cs +++ b/dotnet/test/common/FormHandlingTests.cs @@ -291,7 +291,7 @@ public void EmptyTextBoxesShouldReturnAnEmptyStringNotNull() Assert.That(emptyTextBox.GetDomProperty("value"), Is.Empty); IWebElement emptyTextArea = driver.FindElement(By.Id("emptyTextArea")); - Assert.That(emptyTextBox.GetDomProperty("value"), Is.Empty); + Assert.That(emptyTextArea.GetDomProperty("value"), Is.Empty); } [Test]