我想对输入文本做一个测试。
<input _ngcontent-c21="" autocomplete="new-password" class="form-control modal-input ng-pristine ng-valid ng-touched" id="prenom" name="prenom" type="text" xpath="1">
我的代码是
Click Element xpath://span[contains(text(),'Nous contacter')]
Sleep 2
Location Should Be ${contactPageUrl}
Click Element xpath://input[@id='prenom']
Sleep 2
Element Text Should Be xpath://input[@id='prenom'] ${USERFIRSTNAME}
但我得到的结果是输入的文本是空的,即使不是,也是空的,这是因为以下原因吗?autocomplete="new-password"
?
那是一个 input
领域 type="text"
但您没有输入任何文本。如果您希望该字段能自动填入 ${USERFIRSTNAME}
,那么就缺少了Angular动作的触发。这可能是时间问题,你没有等待字段自动填充,或者你需要点击元素来触发它。