Atata.WebDriverExtras 1.2.0
is released with more detailed exception message generation and new XPathString
class.
Changelog
New Features
- major
#22 Add
XPathString
class for normalization of XPath string values - minor
#23 Add
ToShortIntervalString
andToLongIntervalString
extension methods forTimeSpan
- minor
#24 Add
GetElementId
extension method forIWebElement
- minor
#26 Override
ToString
method inSearchOptions
- major
#27 Add
SearchFailureData
class for detailed exception message generation - major
#28 Add
CreateForNoSuchElement
andCreateForNotMissingElement
overloaded methods toExceptionFactory
that useSearchFailureData
Changes and Enhancements
- minor
#25 Update
IWebElementExtensions.ToDetailedString
method - major
#29 Update
ExtendedSearchContext<T>.Find
method to fillSearchFailureData
for detailed exception generation - major
#30 Update
ExtendedSearchContext<T>.Missing
method to fillSearchFailureData
for detailed exception generation - major
#31 Update
ExtendedSearchContext<T>.MissingAll
methods to fillSearchFailureData
for detailed exception generation - major
#32 Change return type of
ExceptionFactory.CreateForTimeout
method fromWebDriverTimeoutException
toTimeoutException
- major
#33 Use
Selenium.WebDriver
package v3.141.0
Exception Message Improvement
Exception messages were improved to better describe NoSuchElementException
and NotMissingElementException
exceptions generated by ExtendedSearchContext<T>
.
Below are examples of NoSuchElementException
message text generated for the following operation:
IWebElement bodyElement = Driver.Get(By.XPath(".//body"));
bodyElement.Get(By.XPath(".//a")); // Throws NoSuchElementException.
Old Message
Unable to locate element: By.XPath: .//a
Context element:
Tag: body
Location: {X=0,Y=0}
Size: {Width=1920, Height=217}
Text: ...some text...
New Message
Unable to locate visible element:
- By.XPath: .//a
- Search time: 5.031s
- Search options: {Visibility=Visible, Timeout=5s, RetryInterval=0.5s, IsSafely=False}
- Notice: Found 1 element matching specified selector but hidden
Context element:
- Tag: body
- Location: {X=0, Y=0}
- Size: {Width=1920, Height=217}
- Element ID: 0.2859257636091761-1
- Text: ...some text...
New XPathString Class
XPathString
class added with ConvertTo
method for string normalization for XPath.
XPathString.ConvertTo
static method converts a string value to XPath valid string wrapping the value with '
or "
characters.
For string containing both '
and "
characters applies XPath concat
function.
Examples
"a\"b\"c"
=>"'a\"b\"c'"
"a'b'c"
=>"\"a'b'c\""
"a'b\"c"
=>"concat('a',\"'\",'b\"c')"