Atata.WebDriverExtras 1.2.0
is released with more detailed exception message generation and new XPathString class.
Changelog
New Features
- major
#22 Add
XPathStringclass for normalization of XPath string values - minor
#23 Add
ToShortIntervalStringandToLongIntervalStringextension methods forTimeSpan - minor
#24 Add
GetElementIdextension method forIWebElement - minor
#26 Override
ToStringmethod inSearchOptions - major
#27 Add
SearchFailureDataclass for detailed exception message generation - major
#28 Add
CreateForNoSuchElementandCreateForNotMissingElementoverloaded methods toExceptionFactorythat useSearchFailureData
Changes and Enhancements
- minor
#25 Update
IWebElementExtensions.ToDetailedStringmethod - major
#29 Update
ExtendedSearchContext<T>.Findmethod to fillSearchFailureDatafor detailed exception generation - major
#30 Update
ExtendedSearchContext<T>.Missingmethod to fillSearchFailureDatafor detailed exception generation - major
#31 Update
ExtendedSearchContext<T>.MissingAllmethods to fillSearchFailureDatafor detailed exception generation - major
#32 Change return type of
ExceptionFactory.CreateForTimeoutmethod fromWebDriverTimeoutExceptiontoTimeoutException - major
#33 Use
Selenium.WebDriverpackage 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')"