Selenium 2 – Checking If An Element Is Displayed

In the original version of Selenium, you started the selenium server and used it to check if an element is present by calling its isElementPresent( ) method. An example:


In Selenium 2, you call the WebElement method isDisplayed( ) on the element itself, found using the web driver. An example:

WebElement banner = driver.findElement(“pageBanner”));

assertTrue(banner.isDisplayed( ));


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: