我需要选择在搜索字段中输入的文本。传递以下Robot框架selenium关键字:
Run Keyword And Continue On Failure Input Text xpath: //input[@type='search'] 610-Page
Run Keyword And Continue On Failure Execute JavaScript document.getElementsByClassName('input-group').value = "610-Page";
但是当我检查所选字段的值时,输出为空。
Run Keyword And Continue On Failure Element Should Contain xpath: //input[@type='search'] 610-Page
我得到的错误:
Element 'xpath: //input[@type='search']' should have contained text '610-Page' but its text was ''
输入元素不会有文本,它将有 value 关键字。因此,如果您想获取输入框中的文本值,那么您必须获取 value 属性。