我想做以下情况。
答案 0 :(得分:0)
<强>爪哇强>
driver.findElement(By.cssSelector("#twotabsearchtextbox")).sendKeys('computer')
driver.findElement(By.xpath("//div[@id='suggestions']/div[.='computer keyboard']")).click();
driver.findElement(By.cssSelector(".nav-search-submit input").click()
答案 1 :(得分:0)
尝试使用此方法
/**
* @Purpose This method will select a value from list of values based on the
* value parameter we pass in the method
* @param element
* --> element of the webpage
* @param value
* --> value we want to select
* @return N/A
*/
public static void selectElementByValue(WebElement element, String value) {
//log.info("Selecting a value");
Select selectitem = new Select(element);
selectitem.selectByValue(value);
}