Skip to content

Commit c7003a7

Browse files
authored
Merge pull request #125 from quantori/added-tagname-to-iwebelementwrapper-interface
Added property "TagName" to IWebElementWrapper
2 parents 7da144e + 45f00ff commit c7003a7

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Elements/WebElementWrapper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,7 @@ private bool AriaEnabled
124124
return false;
125125
}
126126
}
127+
128+
public string TagName => Element.TagName;
127129
}
128130
}

Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The whole automation code is divided into the following parts:
1616
- UI structure descriptive code
1717
- Supportive code</Description>
1818
<Copyright>Quantori Inc.</Copyright>
19-
<PackageVersion>1.14.1</PackageVersion>
19+
<PackageVersion>1.14.2</PackageVersion>
2020
<RepositoryUrl>https://github.com/quantori/Behavioral.Automation</RepositoryUrl>
2121
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2222
<IncludeSymbols>true</IncludeSymbols>

Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/LabelBinding.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void CheckSelectedText(
3838
[NotNull] string value)
3939
{
4040
Assert.ShouldBecome(() => StringExtensions.GetElementTextOrValue(element), value, behavior,
41-
$"{element.Caption} text is \"{StringExtensions.GetElementTextOrValue(element)}\"");
41+
() => $"{element.Caption} text is \"{StringExtensions.GetElementTextOrValue(element)}\"");
4242
}
4343

4444
/// <summary>
@@ -56,7 +56,7 @@ public void CheckSelectedTextContain(
5656
[NotNull] string value)
5757
{
5858
Assert.ShouldBecome(() => element.Text.Contains(value), !behavior.Contains("not"),
59-
$"{element.Caption} text is \"{element.Text}\"");
59+
() => $"{element.Caption} text is \"{element.Text}\"");
6060
}
6161

6262
/// <summary>
@@ -87,7 +87,7 @@ public void CheckElementTooltip(
8787
public void CheckElementIsEmpty([NotNull] IWebElementWrapper element, AssertionBehavior behavior)
8888
{
8989
Assert.ShouldBecome(() => StringExtensions.GetElementTextOrValue(element), string.Empty, behavior,
90-
$"{element.Caption} text is \"{StringExtensions.GetElementTextOrValue(element)}\"");
90+
() => $"{element.Caption} text is \"{StringExtensions.GetElementTextOrValue(element)}\"");
9191
}
9292

9393
/// <summary>

Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IWebElementWrapper.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,10 @@ public interface IWebElementWrapper
7777
/// Element staleness. See <seealso cref="StaleElementReferenceException"/>
7878
/// </summary>
7979
public bool Stale { get; }
80+
81+
/// <summary>
82+
/// Element's Tag name (span, div, etc.)
83+
/// </summary>
84+
public string TagName { get; }
8085
}
8186
}

Behavioral.Automation.Selenium/Behavioral.Automation/Services/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static int ParseNumberFromString(string s)
126126
/// <returns>String with element's text or value</returns>
127127
public static string GetElementTextOrValue(IWebElementWrapper element)
128128
{
129-
if (ElementTagsToIgnore.Contains(element.Element.TagName) || element.GetAttribute("value") == null)
129+
if (ElementTagsToIgnore.Contains(element.TagName) || element.GetAttribute("value") == null)
130130
{
131131
return element.Text;
132132
}

Behavioral.Automation.Selenium/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
[1.14.1] - 2022-08-01
7+
[1.14.2] - 2022-08-05
88
### Changed
9-
- Changed StringExtensions.GetElementTextOrValue method, so it would always get text value for li elements, otherwise it returns value attribute, which is always index
9+
- Added property "TagName" to IWebElementWrapper
10+
- Updated Label Bindings that use GetElementTextOrValue to get Error message when we actually get an error

0 commit comments

Comments
 (0)