Checking if an element is visible in Chrome using Selenium Remote WebDriver

Posted by Stuart on Stack Overflow See other posts from Stack Overflow or by Stuart
Published on 2010-05-02T15:32:44Z Indexed on 2010/05/02 15:37 UTC
Read the original article Hit count: 173

Filed under:
|
|

Is there a cross browser solution to check if an element is visible using WebDriver? The solution for IE and firefox is to cast the object to a RenderedRemoteWebElement and then call the property Displayed.

I'm using the following methods to return if a element is visible:

/// <summary>
/// Check if the control is visible.
/// </summary>
public bool IsVisible()
{
    IWebElement control = mSelenium.FindElement(mFindBy);
    return ((RenderedRemoteWebElement)control).Displayed;
}

The problem is when I run this using Chrome, I get an exception when casting to type RenderedRemoteWebElement, this is not really the problem as I can catch this, but I need to a solution to check if an element is visible in chrome.

Thanks

© Stack Overflow or respective owner

Related posts about selenium

Related posts about webdriver