我正在尝试在Selenium IDE中测试注册表单,该表单应使用type
命令将文本值输入到输入字段中。
从图片中可以看出,文本字段无法识别为已填充,因此发送按钮不可用。
如何解决这个问题?
我还尝试在click
之前使用clickAt
,focus
,type
命令,但这也无效。
<?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:8090/" />
<title>registr</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">registr</td>
</tr>
</thead>
<tbody>
<tr>
<td>open</td>
<td>/registration</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>xpath=//body/div/div/div/div[2]/div/div[2]/form/div[1]/input</td>
<td>vvv</td>
</tr>
<tr>
<td>type</td>
<td>xpath=//body/div/div/div/div[2]/div/div[2]/form/div[2]/input</td>
<td>vvv@mail.ru</td>
</tr>
<tr>
<td>type</td>
<td>xpath=//body/div/div/div/div[2]/div/div[2]/form/div[3]/input</td>
<td>12345</td>
</tr>
<tr>
<td>type</td>
<td>xpath=//body/div/div/div/div[2]/div/div[2]/form/div[4]/input</td>
<td>12345</td>
</tr>
<tr>
<td>click</td>
<td>name=nextStep</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>xpath=//body/div/div/div/div[2]/div/div[2]/form/div[1]/input</td>
<td>vvv</td>
</tr>
<tr>
<td>type</td>
<td>xpath=//body/div/div/div/div[2]/div/div[2]/form/div[2]/input</td>
<td>vvv</td>
</tr>
<tr>
<td>type</td>
<td>xpath=//body/div/div/div/div[2]/div/div[2]/form/div[3]/input</td>
<td>vvv</td>
</tr>
<tr>
<td>click</td>
<td>xpath=//body/div/div/div/div[2]/div/div[2]/form/div[4]/input</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>xpath=(//button[@type='button'])[3]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>xpath=(//button[@type='button'])[3]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>xpath=(//button[@type='button'])[36]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>xpath=//body/div/div/div/div[2]/div/div[2]/form/div[3]/input</td>
<td>Los-Angeles</td>
</tr>
</tbody>
</table>
</body>
</html>
答案 0 :(得分:1)
刚刚有一个Eurêka!时刻。我建议您使用sendKeys
函数而不是type
函数。 sendKeys
函数模拟键盘按键事件,这可能是此表单所必需的。