Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Selenium - WebElement.isEnabled() vs Canvas.isEnabled()

    In our WebDriver tests, we're able to locate ImgButton objects.

    We want our tests to validate whether the buttons are enabled/disabled in the UI.

    We initially thought we could use WebElement.isEnabled() from Selenium's API, but it seems to always return true for elements we locate using
    Code:
    ByScLocator.scLocator("//ImgButton[ID='<whatever id we provide>'")
    Question #1)
    Using WebDriver, what is the best practice to get the equivalent of Canvas.isEnabled() / Canvas.isDisabled() ?

    Question #2)
    Is Selenium's API WebElement.isDisplayed() reliable ?

    Thank you !

    #2
    As with your other recent questions, if you are not trying to emulate a user action, executing JavaScript is the right approach for checking component states or anything else that occurs to you as a programmatic test that is not an end user action. So the best practice for determining "isEnabled()" is just to call "isEnabled()".

    As far as WebElement.isDisplayed() - what are you trying to test with this? It's not clear if it will correctly take into account things like occlusion, partial occlusion, scrolling out of view, modal dialogs, etc.



    Comment

    Working...
    X