Background : Web page get blank (So script fails as there is no element to locate, only blank page) during selenium script execution in random place only on staging server while same working on production.
Is there a way in selenium to get the page size ? I want to get the page size and check whether it is blank (means no content rendered ) if so then hit the URL again.
I'm thinking to manage this code in tear down method which logs the test failure :
@AfterMethod
public void tearDown(ITestResult result)
{
if(ITestResult.FAILURE==result.getStatus())
{
try
{
TakeScreenshot.failedScreenShot(result.getMethod().getMethodName());
LogWriter.logger.info(result.getThrowable().toString());
}
catch (Exception e)
{
LogWriter.logger.info("Exception while taking screenshot "+e.getMessage());
}
}
}
Can someone please suggest me if it is possible or is there any alternative that i can implement the same for my deed.