입력 텍스트 필드가있는 JSP 페이지가 있습니다.셀레늄 유형 방법을 사용하는 방법은 무엇입니까?
<table>
<tr>
<td><input type="text" id="searchText" name="searchInput"/></td>
</tr>
</table>
검색 입력 텍스트가 있는지 확인하는 셀렌 테스트 케이스를 작성했습니다.
public class UIRecipeListTest extends SeleneseTestBase {
@Before
public void setup() {
WebDriver driver = new FirefoxDriver(new FirefoxBinary(new File(
"C:\\Program Files (x86)\\Mozilla Firefox 3.6\\firefox.exe")), new FirefoxProfile());
String baseUrl = "http://localhost:8080/RecipeProject/";
selenium = new WebDriverBackedSelenium(driver, baseUrl);
}
@Test
public void testShowRecipes() {
verifyTrue(selenium.isElementPresent("searchText"));
selenium.type("searchText", "salt");
}
}
verifyTrue 테스트 수익을 사실. 그러나 selenium.type 시험이 오류로 인해 실패 : com.thoughtworks.selenium.SeleniumException : 요소 검색 텍스트가
나는 시험 작품을 만들기 위해 어떻게해야 하는가를 찾을 수 없습니다?
감사합니다.
으로 검색 필드에 해당 텍스트가 표시되지 않습니다. – Smit
@smit : 예외는 셀렌이 searchText의 id를 가진 입력 텍스트를 찾을 수 없다는 것을 의미한다고 생각합니다. 그러나 verify true는 해당 id를 가진 요소가 있음을 증명했습니다. – zfranciscus
내가 잘못되었을 수 있습니다. 방금 재미있게 셀레늄을 가지고 놀았습니다. 그러나 그 텍스트 필드를 기다려야 할 수도 있습니다. – Smit