Robot framework: How to locate a input text field and how to input a value in it

6.2k views Asked by At

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.

My HTML is like this:

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

if I try to get the Xpath of the html path I get below Input Text path but I am also not been able to input any text and get below error

Element with locator 'xpath://*[@id="extensions-container"]/div/div[3]/div2/div2/div/div2/form/span2/input' not found.

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 

2

There are 2 answers

1
Philip Seyfi On BEST ANSWER

This should work:

Input Text    css:input[placeholder="Search for extensions"]    cli
0
Todor Minakov On

Try with this locator:

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