How to verify html source in selenium, Selenium Notes,Examples, Videos by.www.laxmiroy.blogspot.com/
We can verify the html source with selenium commands
<html>
<head>
<title>HTML Source</title>
</head>
<body>
what need to be verifed Text is here we need to verify
</body>
</html>
Script
verifyTrue(selenium.getHtmlSource().matches("^[\\s\\S]*Text is here[\\s\\S]*$"));
above command will verify Text is here in above html srource
verifyTrue(selenium.getHtmlSource().matches("^[\\s\\S]*Text i here[\\s\\S]*$"));
above command will fail because it tries to verify Text i here which is not there in html source
No comments:
Post a Comment