如何在机器人框架上获取文本输入(autocomplete =“ new-password”)?

时间:2020-05-25 11:58:24

标签: robotframework

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

<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"吗?

1 个答案:

答案 0 :(得分:0)

这是input的{​​{1}}字段,但是您没有在其中输入任何文本。如果您期望用type="text"自动填充该字段,则缺少触发Angular操作的触发。这可能是一个计时问题,您没有等待该字段自动填充,或者您需要单击该元素以触发它。

相关问题