2014-07-25 195 views
-1

从动态下拉列表中选择选项时出现问题。 我已经尝试了几种选择: - 通过从选择列表中选择(在'target'中我试过(标签,索引,值)) - 通过从div id =“id_language_chzn(在'target'我想应该是工作(标签,索引值))如何从动态下拉列表中选择选项

没有

代码是在这里:http://pastebin.com/v3Q7NDGs

的问候,如果能帮助我在此, Szymon

+0

我看到你的代码,但我不明白,您使用哪种语言?我在Python中有同样的问题...也许我可以帮你,因为功能相似 – Lara

+0

@Lara我使用HTML/CSS的硒IDE。 –

回答

0

我会做这样的:

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 
By ddLocator = By.xpath(".//select[1]"); 
By items = By.xpath(".//option"); 
ByChained comboBox1 = new ByChained(".//select[1]", ".//option"); 
List<WebElement> allOptions = driver.getElements(comboBox1); 
for (WebElement we : allOptions) { 
    // do something here 
} 
0

好了,它发生的硒IDE有一些问题,采取了选择的选项。我已经使用webdriver,它有帮助。

下面是代码:

driver.findElement(By.cssSelector("a.class > span")).click(); 
driver.findElement(By.id("id_name[1]")).click(); 
相关问题