WebElement element = driver.findElement(By.id("passwd-id"));//将输入框清空element.clear(); //在输入框中输入内容:element.sendKeys(“test”);//获取输入框的文本内容:element.getText();
3.2.2 下拉框-Select
Select select = new Select(driver.findElement(By.id("select"))); select.selectByVisibleText(“A”);select.selectByValue(“1”); select.deselectAll();select.deselectByValue(“1”);select.deselectByVisibleText(“A”);select.getAllSelectedOptions();select.getFirstSelectedOption();