How to get HTML5 validation error message text using selenium webdriver
2,943 views
Skip to first unread message
Jayendra B
unread,
Apr 12, 2015, 5:08:05 PM4/12/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to webd...@googlegroups.com
I wants to read the HTML5 required field error messages using selenium webdriver with java
I want the text "Please fill in this field" using webdriver
darrell
unread,
Apr 13, 2015, 8:10:25 AM4/13/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to webd...@googlegroups.com
If the input element has the attribute 'required' then it will display "Please fill in this field.". So all you have to do is find the element, using findElement() then use getAttribute('required'). If getAttribute returns NULL then the attribute does not exist. Otherwise, it should return the String "true".
Subhash Gaddampally
unread,
Apr 16, 2015, 7:45:37 AM4/16/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to webd...@googlegroups.com
you can use mouse hover to that element with the help of moveToElement method from actions class. and then check error message element is present .and then extract text by getText()
this scenario is like tooltip information on mouse hover.