Element is not visible(hide) but is found on the page

I hava a drop-down list and a checkbox,
I need to do a test to checking when an item in drop-down list is selected
the checkbox will be removed(hide)

// Select an item in drop-down list


Select drpdwn = new Select(driver.findElement(By.id("drpdwnID")));

drpdwn.selectByIndex(1);

// To verify checkbox is not available (removed) on the page.


Boolean isChkbxExists = driver.findElements(By.name("chkbxID")).size()!= 0;
if (isChkbxExists == true){

// write FAIL into excel if chkbx is exist

SuiteUtility.WriteResultUtility(xls, sheetName, Constant.COL_CHKBX_REMOVED, rowNum, "FAIL");

Testfail = true;

}else{

SuiteUtility.WriteResultUtility(xls, sheetName, Constant.COL_CHKBX_REMOVED, rowNum, "PASS");

Testfail = false;

}

during the test, once the drop-dorn list is selected, the checkbox will not visible on the page
however the expected test result fail as the checkbox is found on the page (even chkbx is not visible.)

How can I get the result for PASS (checkbox is not available (removed) on the page.)?

Add Comment
1 Answer(s)

solved the problem with method  isDisplayed().
case closed

nexuschristo Train Answered on March 4, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.