java - Not able to find the elements when the page is loaded -


while clicking url, new page loaded . after page loaded , not able find out elements in page. have used below code . getting no such element exception only. please on issue?

webelement element7 = driver.findelement(by.id("linkid")); if (element7.isenabled()) {     element7.click();     system.out.println(" report selected"); }  testclass.waitforpageloaded(driver); // using method have been waiting page new page load.     //find elements in new page .  webelement element8 = driver.findelement(by.id("cbperiodtype")); if(element8.isdisplayed()) {        select periodtype = new select(driver.findelement(by.id("cbperiodtype`enter code here`")));          periodtype.selectbyvalue("1");     system.out.println("periodtypeselected"); } 

looks element lookup fast. use explicit wait when finding element. see full list of expectedconditions here

// find elements in new page .  //webelement element8 = driver.findelement(by.id("cbperiodtype")); webelement element8 = (new webdriverwait(driver, 10))   .until(expectedconditions.presenceofelementlocated(by.id("cbperiodtype")));  select periodtype = new select(driver.findelement(element8 ));      periodtype.selectbyvalue("1");  system.out.println("periodtypeselected"); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -