0

目前正在研究中selenium webdriver。我正在尝试选择多个下拉列表,它是过滤器选择。一旦我选择了多个下拉菜单,我将单击“应用过滤器”按钮,然后我将根据所选过滤器部分生成结果。所以我在选择多个下拉菜单时遇到问题,无法点击应用过滤器下拉菜单。你能帮我弄清楚如何使用代码。我正在使用 java

这是我的示例代码:

driver.findElement(By.id("ext-new-prs")).click();
new Select(driver.findElement(By.id("visualizationId"))).selectByVisibleText("Center");
new Select(driver.findElement(By.id("periodId"))).selectByVisibleText("Last 52 Weeks");
new Select(driver.findElement(By.id("topographyId"))).selectByVisibleText("Center");
driver.findElement(By.cssSelector("#topographyId > option[value=\"center\"]")).click();
new Select(driver.findElement(By.id("centerId"))).selectByVisibleText("OAB");
new Select(driver.findElement(By.id("featureRequestId"))).selectByVisibleText("Include");
driver.findElement(By.id("kpiFilterSubmit")).click();
4

2 回答 2

0

如下所示:-

Actions actions = new Actions(driver);
WebElement dBox1= (new WebDriverWait(driver,10)).until(ExpectedConditions.elementToBeClickable(By.id("visualizationId"))).selectByVisibleText("Center");
actions.moveToElement(dBox1);
actions.click();
actions.perform();
于 2013-11-15T20:22:13.013 回答
0
public static void waitforElement (WebDriver driver , int Seconds , String Locator )
{
WebDriverWait wait=new WebDriverWait(driver, Seconds);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locator)));
}
use this method
waitforElement(driver,30,"//div[@id='divGrid']");
call like this
By sundar
www.mjksundar.weebly.com
于 2013-12-03T09:56:24.810 回答