我正在使用 Selenium WebDriver 运行测试
我对输入文本字段("Select Source: By Name:")有疑问。当我在文本字段中输入字符串“ABC 高级新闻(澳大利亚)”时,会显示一个选项。然后我需要单击(或选择)它。我尝试了所有带有 fireEvent 的方法......没用。
以下是源代码:
driver.get("http://www...");
driver.switchTo().frame("mainFrame");
WebElement sourceTitle = driver.findElement(By.name("sourceTitle"));
sourceTitle.sendKeys("ABC Premium News (Australia)");
//Now a "combobox-like" option "ABC Premium News (Australia)" shows up...how do I click it?
// I tried fireEvent...it did not help. The following is one of my trials that does not work:
DefaultSelenium sel = new WebDriverBackedSelenium(driver,"http://www....");
sel.type("//input[@id='destination']", "ABC Premium News (Australia)");
sel.fireEvent("//input[@id='destination']", "keydown");
// In addition to keydown, I tried: onclick, onfocus, onblur...