机器人框架:如何找到输入文本字段以及如何在其中输入值

问题描述

I have a search field in the web page that I would like to locate and search the extension in the page and click on the first search that comes in. Below is the page snippet and HTML code.

我的HTML是这样的:

<input type="text" placeholder="Search for extensions" class="user-input" style="width: 370px;">

如果我尝试获取html路径的Xpath,则会在“输入文本”路径以下,但是我也无法输入任何文本并出现以下错误

具有定位符'xpath:// * [@ id =“ extensions-container”] / div / div [3] / div 2 / div 2 / div / div {{3 }} /表单/跨度2 /输入”。

Click Element    name:extensions
Input Text       xpath://*[@id="extensions-container"]/div/div[3]/div[1]/div[1]/div/div[1]/form/span[1]/input    cli 

解决方法

尝试使用此定位器:

//input[@placeholder="Search for extensions"] 
,

这应该有效:

Input Text    css:input[placeholder="Search for extensions"]    cli