如何在机器人框架上获取文本输入(自动完成= "new-password")?



我想对输入文本进行测试:

<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 操作的触发。这可能是计时问题,您没有等待字段自动填充,或者您需要单击元素来触发它。

相关内容

最新更新