Saturday 23 January 2016

Getting Error Message : org.openqa.selenium.ElementNotVisibleException: Element is not displayed



Reason : The object is not visble, so its throws this exception in ie (Even if its display in IE). So we need to make it display before run script.

Solution:





Selenium determines an element is visible or not by the following criteria (use a DOM inspector to determine what css applies to your element, make sure you look at computed style):

visibility != hidden
display != none (is also checked against every parent element)
opacity != 0 (this is not checked for clicking an element)
height and width are both > 0
for an input, the attribute type != hidden

Your element is matching one of those criteria. If you do not have the ability to change the styling of the element, here is how you can forcefully do it with javascript.

((JavascriptExecutor)driver).executeScript("arguments[0].checked = true;", inputElement);

or

jse.executeScript("document.getElementById('mini-7').setAttribute('checked', 'true');");





1 comment:

  1. Best place to learn Appium Android IOS Automation Testing Training in Chennai

    Go for Appium training in chennai for real time mobile automation testing training with real time project support.
    UI Automation Tools with real time scenarios You can contact 8122241286 for Best APPIUM and selenium Training in Chennai

    ReplyDelete