Input 机器人框架文本字段的清除和输入
我正在使用Robot框架自动化一个网页。该页面具有不寻常的文本字段,在按Enter键输入无效值时,这些字段会自动接收输入(而不是占位符值) 以下是文本字段:Input 机器人框架文本字段的清除和输入,input,automation,textfield,robotframework,selenium2library,Input,Automation,Textfield,Robotframework,Selenium2library,我正在使用Robot框架自动化一个网页。该页面具有不寻常的文本字段,在按Enter键输入无效值时,这些字段会自动接收输入(而不是占位符值) 以下是文本字段: 您是否尝试过使用关键字清除元素文本: Clear Element Text xpath=//input[@id='ember475'] 此处的详细信息这可能适合您: *** Keywords *** Clear Field Of Characters [Arguments] ${field} ${character
您是否尝试过使用关键字清除元素文本:
Clear Element Text xpath=//input[@id='ember475']
此处的详细信息这可能适合您:
*** Keywords ***
Clear Field Of Characters
[Arguments] ${field} ${character count}
[Documentation] This keyword pushes the delete key (ascii: \8) a specified number of times in a specified field.
:FOR ${index} IN RANGE ${character count}
\ Press Key ${field} \\8
Input Into Text Field
[Arguments] ${field} ${text}
[Documentation] Keyword is just an input text keyword. That clears the text field dynamically.
${field text}= Get Value ${field}
${field text length}= Get Length ${field text}
Clear Field of Characters ${field} ${field text length}
Press Key ${field} ${text}
如果输入了所有文本,则不会在字段中按enter键。您可以将下面的连接到端部,或在以后的单独通话中完成
Press Key ${field} \\13 #I believe 13 is the ascii for carriage return, \n may work as well.