0
我是Selenium IDE的新手。我使用Html 5驗證創建了簡單的表單。如何在Selenium IDE中驗證HTML 5驗證彈出窗口的文本
我已經在Selenium IDE中爲測試表單創建了測試用例。但是當我嘗試驗證彈出窗口「請填寫此字段」時,測試用例失敗。這是使用selenese命令verifyAlertPresent的html 5驗證彈出窗口。
如何在selenium IDE中驗證Html 5驗證彈出窗口?
我附上兩張截圖:
但有一個問題,它是不工作的基於特定id的測試用例。如果我想在代碼中檢查id = name,它可以正常工作,但在第二個命令中,如果我想檢查「Plea se填寫這個字段「爲id =電子郵件然後它採取流行的ID =名稱和案件越過。這裏是我的代碼:
測試用例:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost/testform.html" />
<title>testform</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">testform</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/testform.html</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>css=button[type="submit"]</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td></td>
<td>5000</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>id=name</td>
<td>//*[contains(., 'Please fill out this field.')]</td>
</tr>
<tr>
<td>pause</td>
<td></td>
<td>5000</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>id=email</td>
<td>//*[contains(., 'Please fill out this field.')]</td>
</tr>
</tbody></table>
</body>
</html>
HTML代碼:
<!DOCTYPE html>
<html>
<head>
<title>
Test Form for Selenium
</title>
</head>
<body>
<form ><center>
Name:<input id="name" type="text" required/><br/><br/>
Email:<input id="email" type="email" required/><br/><br/>
<button type="submit" >submit</button>
<center>
</form>
</body>
</html>
感謝答覆,但我的測試工作,如果我把// * [包含( '請填寫此域')的價值
您需要它在第二列中查找定位器。 – DMart 2015-02-26 13:32:28