public void Test003() {
new Select (webDriver.findElement(By.cssSelector("select"))).selectByVisibleText("NEC_COCONA_GG3");
webDriver.manage().timeouts().implicitlyWait(1,TimeUnit.MILLISECONDS);
webDriver.findElement(By.xpath("//div[@id='main-menu']/ul/li[5]/a")).click();
webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.MILLISECONDS);
webDriver.findElement(By.id("issue_subject")).sendKeys("Test");
webDriver.findElement(By.id("issue_description")).sendKeys("Test");
webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.MILLISECONDS);
new Select(webDriver.findElement(By.id("issue_assigned_to_id"))).selectByVisibleText("<<me>>");
webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.MILLISECONDS);
new Select(webDriver.findElement(By.id("issue_custom_field_values_7"))).selectByVisibleText("QA");
webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.MILLISECONDS);
webDriver.findElement(By.id("issue_custom_field_values_27")).sendKeys("Test");
webDriver.findElement(By.xpath("//*[@id='attachments_fields']/span/input[1]")).sendKeys("D:\\NEC new\\log\\EASCrash.txt");
webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.MILLISECONDS);
webDriver.findElement(By.xpath("//*[@id='attachments_form']/span[2]/a")).click();
webDriver.findElement(By.xpath("//*[@id='attachments_fields']/span[2]/input[1]")).sendKeys("D:\\NEC new\\log\\crash_info_201304171712.txt");
webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.MILLISECONDS);
webDriver.findElement(By.xpath("//input[@name='issue[watcher_user_ids][]' and @value='102']")).click();
webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.MILLISECONDS);
webDriver.findElement(By.xpath("//*[@id='issue-form']/input[1]")).click();
webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.MILLISECONDS);
}
雖然運行腳本硒是無法得到的無法使用Selenium 2選擇元素?
new Select (webDriver.findElement(By.cssSelector("select"))).selectByVisibleText("NEC_COCONA_GG3");
值選擇該測試用例中失敗。顯示
錯誤是:
org.openqa.selenium.WebDriverException: Driver does not support finding an element by selector: select
。您是否想要打開下拉菜單並選擇其中的一個項目? –
另外,什麼是「select」? –
您不必在每次查找元素時設置隱式等待,只需設置一次在開始時忘記它,它會完成它的工作,而且3毫秒可以忽略不計,並且可能不會幫助。 –