i have an UI where drop down are present with 20,50,100,500,1000 values.20 is the default value.I need to write the selenium java code to fetch the values and compare it.below is the code i have written.
WebElement show = driver.findElement(By.xpath(".//*[@id='revtable_length']/label"));
Select sel= new Select(show);
List <WebElement> option= sel.getOptions();
//sAssert.assertEquals(show,"Show20501005001000 entries","retrieve table dropdown button is not present");
for (int i= 0; i< option.size(); i++)![enter image description here][1]
System.out.print((option.get(i)).getText());
but i am getting the error:
org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "label"
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-27 00:00:10'
System info: host: 'bionicps0000574', ip: '167.209.185.85', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_20'
Driver info: driver.version: unknown
Aucun commentaire:
Enregistrer un commentaire