diff --git a/dotnet/src/support/UI/SelectElement.cs b/dotnet/src/support/UI/SelectElement.cs index 71b06a229245d..e8090105ca6b7 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"; } @@ -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/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/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/ChildrenFindingTest.cs b/dotnet/test/common/ChildrenFindingTest.cs index 6588c7c88a43a..b8d0153272876 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] @@ -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")); } @@ -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/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..ca31f46292f64 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); } @@ -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.GetDomAttribute("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"))); } @@ -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"))); } @@ -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] @@ -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"); } @@ -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")); } @@ -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] @@ -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] @@ -212,7 +210,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")); } @@ -222,7 +220,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")); } @@ -232,7 +230,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("")); } @@ -242,12 +240,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); } @@ -258,7 +256,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")); } @@ -268,31 +266,31 @@ 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] 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")); } + [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.GetAttribute("id"), Is.EqualTo("th1"), "th1 id"); - Assert.That(th1.GetAttribute("colspan"), Is.EqualTo("3"), "th1 colspan should be 3"); + Assert.That(th1.GetDomAttribute("id"), Is.EqualTo("th1"), "th1 id"); + Assert.That(th1.GetDomAttribute("colspan"), Is.EqualTo("3"), "th1 colspan should be 3"); - Assert.That(td2.GetAttribute("id"), Is.EqualTo("td2"), "td2 id"); - Assert.That(td2.GetAttribute("colspan"), Is.EqualTo("2"), "td2 colspan should be 2"); + Assert.That(td2.GetDomAttribute("id"), Is.EqualTo("td2"), "td2 id"); + Assert.That(td2.GetDomAttribute("colspan"), Is.EqualTo("2"), "td2 colspan should be 2"); } // This is a test-case re-creating issue 900. @@ -303,7 +301,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 +310,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] @@ -325,7 +323,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] @@ -333,9 +331,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 +341,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 +351,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] @@ -363,25 +361,28 @@ 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); + Assert.That(element2.GetDomAttribute("nowrap"), Is.Null); } [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.GetAttribute("required"), Is.EqualTo("true")); + Assert.That(element1.GetDomAttribute("required"), Is.Empty); IWebElement element2 = driver.FindElement(By.Id("emptyTextAreaRequired")); - Assert.That(element2.GetAttribute("required"), Is.EqualTo("true")); + Assert.That(element2.GetDomAttribute("required"), Is.Empty); IWebElement element3 = driver.FindElement(By.Id("inputRequired")); - Assert.That(element3.GetAttribute("required"), Is.EqualTo("true")); + Assert.That(element3.GetDomAttribute("required"), Is.Empty); IWebElement element4 = driver.FindElement(By.Id("textAreaRequired")); - Assert.That(element4.GetAttribute("required"), Is.EqualTo("true")); + Assert.That(element4.GetDomAttribute("required"), Is.Empty); IWebElement element5 = driver.FindElement(By.Id("unwrappable")); - Assert.That(element5.GetAttribute("nowrap"), Is.EqualTo("true")); + Assert.That(element5.GetDomAttribute("nowrap"), Is.Empty); } [Test] @@ -389,7 +390,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 +398,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 +406,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 +414,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 +422,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] @@ -429,7 +430,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] @@ -439,7 +440,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 f1375531be5f3..98ed08cde1881 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] @@ -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] @@ -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 @@ -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 @@ -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] @@ -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] @@ -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 @@ -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 @@ -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] @@ -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] @@ -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] @@ -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/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..33b177fc2060b 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(emptyTextArea.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..4896fd7a99215 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] @@ -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")); } @@ -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/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")); } } } 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..9dd27dfa92666 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] @@ -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] @@ -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] 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/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/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] 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] 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")); } } } 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..e6de47c33f49d 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] @@ -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")); } } 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] 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)")); diff --git a/dotnet/test/support/UI/SelectTests.cs b/dotnet/test/support/UI/SelectTests.cs index d4966e29aea6c..846e3fd22fdbe 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,8 +168,8 @@ public void CanSetSingleOptionSelectedByIndex() options.Add(option1.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns((string)null); - option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("2"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns((string)null); + 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(_ => _.GetAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); } @@ -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,12 +246,12 @@ public void CanSetMultipleOptionSelectedByIndex() options.Add(option2.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); - option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("1"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); + option1.Setup(_ => _.GetDomProperty(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(_ => _.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(_ => _.GetAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); option2.Verify(_ => _.Selected, Times.Once); option2.Verify(_ => _.Click(), Times.Once); - option2.Verify(_ => _.GetAttribute(It.IsAny()), Times.Once); + option2.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); webElement.Verify(_ => _.FindElements(It.IsAny()), Times.Once); } @@ -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,14 +313,14 @@ public void CanDeselectSingleOptionSelectedByIndex() options.Add(option1.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); - option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("2"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); + 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(_ => _.GetAttribute(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); @@ -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,20 +381,20 @@ public void CanDeselectMultipleOptionSelectedByIndex() options.Add(option2.Object); webElement.SetupGet(_ => _.TagName).Returns("select"); - webElement.Setup(_ => _.GetAttribute(It.Is(x => x == "multiple"))).Returns("true"); - option1.Setup(_ => _.GetAttribute(It.IsAny())).Returns("1"); + webElement.Setup(_ => _.GetDomAttribute(It.Is(x => x == "multiple"))).Returns("true"); + option1.Setup(_ => _.GetDomProperty(It.IsAny())).Returns("1"); option1.SetupGet(_ => _.Selected).Returns(true); option1.Setup(_ => _.Click()); - option2.Setup(_ => _.GetAttribute(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(_ => _.GetAttribute(It.IsAny()), Times.Once); + option1.Verify(_ => _.GetDomProperty(It.IsAny()), Times.Once); option1.Verify(_ => _.Selected, Times.Never); option1.Verify(_ => _.Click(), Times.Never); - option2.Verify(_ => _.GetAttribute(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); @@ -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();