Atata.WebDriverExtras 1.2.0 is Released

April 11, 2019 by Yevgeniy Shunevych


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 and ToLongIntervalString extension methods for TimeSpan
  • minor #24 Add GetElementId extension method for IWebElement
  • minor #26 Override ToString method in SearchOptions
  • major #27 Add SearchFailureData class for detailed exception message generation
  • major #28 Add CreateForNoSuchElement and CreateForNotMissingElement overloaded methods to ExceptionFactory that use SearchFailureData

Changes and Enhancements

  • minor #25 Update IWebElementExtensions.ToDetailedString method
  • major #29 Update ExtendedSearchContext<T>.Find method to fill SearchFailureData for detailed exception generation
  • major #30 Update ExtendedSearchContext<T>.Missing method to fill SearchFailureData for detailed exception generation
  • major #31 Update ExtendedSearchContext<T>.MissingAll methods to fill SearchFailureData for detailed exception generation
  • major #32 Change return type of ExceptionFactory.CreateForTimeout method from WebDriverTimeoutException to TimeoutException
  • 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')"