-> we can use isDisplayed() function in Selenium webdriver for verify the Web Element Displayed or not in webpage.
-> Its return the boolean value.
-> Its returns "true" if WebElement Displayed
-> Its returns "false if WebElement not Displayed.
public void UserObject_Disabled(WebElement element1)
{
boolean Result;
System.out.println("Inside UserObject_Disabled");
do
{
try
{
Result=element1.isDisplayed();
if(Result)
System.out.println("OBject Still display" );
else
System.out.println("OBject is not display");
}
catch (StaleElementReferenceException e)
{
Result=false;
System.out.println("OBject is not display");
}
catch (WebDriverException e)
{
Result=false;
System.out.println("OBject is not display");
}while(Result);
}
But from above code, Selenium throw the exception if webElement is not displayed in web page. So i have included the above Exception handling
method for handle this situation.
No comments:
Post a Comment