test condition - to verify the field validation ,i.e if i enter a invalid data in that Text box, then capture the Exception value and verify the same (Please enter first name) so, following are my HTML code
Before Execution (validation)
<input type="text" class="input-txt" data-bind="value: FirstName" id="txtFirstName"
title="Please enter first name" data-orig-title="">
<span class="f-req" style="display: none;"></span>
After Execution of Validation
<input type="text" class="input-txt ErrorControl" data-bind="value:
FirstName"id="txtFirstName" title="Please enter first name" data-orig-title="">
<span class="f-req" style="">Please enter first name</span>
how can verify the validation message if exist or not during invalid entry pass in that object
my code is
\\ passing empty value so its thrown an error message
firstname.sendKeys("");
\\checking if the "input-txt ErrorControl" class are enabled or not
System.out.println("class name" + firstname.getAttribute("class"));
if i execute it always getting "input-txt" class not getting the "input-txt ErrorControl"
Please provide help how to handle this
Thanks
prabu
try to sendKeys(" ")
of another invalid symbols. And then use this check:
webdriver.findElement(By.cssSelector("input#txtFirstName")).getAttribute("class").contains("ErrorControl")