java - Not able to select an option from the dropdown leading to ElementNotVisibleException -


import java.util.list; import java.util.concurrent.timeunit; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.webelement; import org.openqa.selenium.chrome.chromedriver; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.support.ui.select;  public class delldropdown {      public static void main(string[] args) {         webdriver driver=new firefoxdriver();         driver.manage().timeouts().implicitlywait(20, timeunit.seconds);         driver.get("http://www.dell.com/");         webelement dropdown=driver.findelement(by.xpath("//select[@class='para_small']"));         select select=new select(dropdown);         select.selectbyindex(5);         list<webelement> options=select.getoptions();         for(int i=0;i<options.size();i++)         {             options.get(i).gettext();         }     } } 

i getting elementnotvisibleexception on @ line select.selectbyindex(5), can me in regard?

you may have wait until drop down visible, before venture select options:

wait.until(expectedconditions.visibilityofelementlocated(by.xpath("//select[@class='para_small']"))) 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -