NSelene
NSelene copied to clipboard
add locator string to composed error messages for chained exceptions
Open("http://todomvc4tasj.herokuapp.com/");
S("#new-todo").SetValue("a").PressEnter();
SS("#todo-list>li").FindBy(Have.ExactText("a"))
.DoubleClick();
SS("#todo-list>li").FindBy(Have.ExactText("a"))
.S(".edit").SetValue("a edited").PressEnter();
fails with
Result Message:
Test method Lesson1.TodoMVCTests.ProvidesCommonTasksManagement threw exception: OpenQA.Selenium.WebDriverTimeoutException: Timed out after 4 seconds while waiting for condition: : NSelene.Conditions.Visible Expected: True Actual: False ---> OpenQA.Selenium.WebDriverTimeoutException: Timed out after 4 seconds while waiting for condition: : NSelene.Conditions.Visible Expected: True Actual: False ---> OpenQA.Selenium.NotFoundException: element was not found by conditionNSelene.Conditions.ExactText Expected: contains a Actual:
and is not informative enough
First two Exceptions in the chain: tells just that something was not visible.. But what? The solution would be "adding locator string to the error message" in order to identify to which element search the error message belogns to.
fixed to:
OpenQA.Selenium.WebDriverTimeoutException :
Timed out after 0.25 seconds
while waiting entity with locator: By.Selene: (By.Selene: (By.CssSelector: #todo-list>li).FindBy(ExactText is a)).FindInner(By.CssSelector: .edit)
for condition: Visible
Expected : True
Actual : False
----> OpenQA.Selenium.WebDriverTimeoutException :
Timed out after 0.25 seconds
while waiting entity with locator: By.Selene: (By.CssSelector: #todo-list>li).FindBy(ExactText is a)
for condition: Visible
Expected : True
Actual : False
----> OpenQA.Selenium.NotFoundException : element was not found in collection by condition ExactText is a
Actual visible texts : []
Actual html elements : [<li class="active editing" data-index="0">
<div class="view">
<input value="a" class="toggle" type="checkbox">
<label>a</label>
<button class="destroy"></button>
</div>
<input class="edit">
</li>]
unit test needed