I am using the following code after updating the new selenium 3.0 beta
jar files. However in earlier version of selenium it was working perfectly.
I updated as it was giving error :
org.openqa.selenium.NoSuchElementException: Cannot locate option with index: 1
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: 'unknown', revision: '2aa21c1', time: '2016-08-02 14:59:43 -0700' System info: host: 'GUR-ITD-8C', ip: '172.21.45.117', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_31' Driver info: driver.version: unknown
expedia.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Select LineOfBusiness = new Select(expedia.findElement(By.id("lineOfBusiness")));
LineOfBusiness.selectByIndex(1);
Assert.assertEquals(LineOfBusiness.getFirstSelectedOption().getText(), "HWW Sales");
System.out.println(LineOfBusiness .getOptions().size());
and let us know the result..:) – Saurabh GaurSystem.out.println(LineOfBusiness.getOptions().size());
?? – Saurabh GaurLineOfBusiness.selectByVisibleText("HWW Sales");
?? – Saurabh Gaur