Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3f8cae8
Get attribute value
nvborisenko Dec 7, 2024
46b9ed6
Get attribute id
nvborisenko Dec 7, 2024
7328f50
name
nvborisenko Dec 7, 2024
6fc9b70
class
nvborisenko Dec 7, 2024
b26630d
readonly
nvborisenko Dec 7, 2024
81a234e
required
nvborisenko Dec 7, 2024
acbf7b8
rows
nvborisenko Dec 7, 2024
3cdb358
nowrap
nvborisenko Dec 7, 2024
59adbba
multiple
nvborisenko Dec 7, 2024
c4d2cde
innerHTML
nvborisenko Dec 7, 2024
b5be6f2
textContent
nvborisenko Dec 7, 2024
ba85145
index
nvborisenko Dec 7, 2024
2b9d171
cheese
nvborisenko Dec 7, 2024
dcea810
colspan
nvborisenko Dec 7, 2024
5d050fd
style
nvborisenko Dec 7, 2024
a73eec9
disabled
nvborisenko Dec 7, 2024
2b74ae6
onclick
nvborisenko Dec 7, 2024
bd26d88
transform
nvborisenko Dec 7, 2024
6b46e27
dynamicProperty
nvborisenko Dec 7, 2024
f6aa829
fill
nvborisenko Dec 7, 2024
7f04248
type
nvborisenko Dec 7, 2024
120cc8b
href
nvborisenko Dec 7, 2024
bcde363
Mocks for multiple
nvborisenko Dec 7, 2024
27e623c
src
nvborisenko Dec 7, 2024
afebc9b
checked
nvborisenko Dec 7, 2024
0b13270
selected
nvborisenko Dec 7, 2024
ba22c43
Revert "selected" - there is webdriver spec for selected
nvborisenko Dec 7, 2024
2524f0a
Use native `Selected` property instead of attr/prop
nvborisenko Dec 7, 2024
71a306a
Fix ShouldReturnNullWhenGettingSrcAttributeOfInvalidImgTag test
nvborisenko Dec 7, 2024
ba2b798
Finally in support UI
nvborisenko Dec 7, 2024
d6eb013
Fix select in support package
nvborisenko Dec 7, 2024
855f06a
Fix SelectTests via getting index as property
nvborisenko Dec 8, 2024
4dbf305
Fix mocks for select index
nvborisenko Dec 8, 2024
4443913
Align ShouldReturnEmptyStringForPresentBooleanAttributes test with ja…
nvborisenko Dec 8, 2024
3ec2724
Update FormHandlingTests.cs
nvborisenko Dec 12, 2024
2cc66df
Merge branch 'trunk' into dotnet-get-attribute-tests
nvborisenko Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dotnet/src/support/UI/SelectElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/WebElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ public virtual void SendKeys(string text)
/// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
public virtual void Submit()
{
string elementType = this.GetAttribute("type");
string elementType = this.GetDomAttribute("type");
if (elementType != null && elementType == "submit")
{
this.Click();
Expand Down
4 changes: 2 additions & 2 deletions dotnet/test/common/BiDi/Input/DefaultKeyboardTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
22 changes: 11 additions & 11 deletions dotnet/test/common/ChildrenFindingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand All @@ -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"));
}


Expand Down Expand Up @@ -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"));
}


Expand All @@ -189,8 +189,8 @@ public void FindElementsByLinkText()
ReadOnlyCollection<IWebElement> 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]
Expand Down Expand Up @@ -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"));
}


Expand All @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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"));
}
}
}
8 changes: 4 additions & 4 deletions dotnet/test/common/ClearTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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));
}
}
}
2 changes: 1 addition & 1 deletion dotnet/test/common/CorrectEventFiringTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading
Loading