Kevin de Boer
Kevin de Boer

Reputation: 115

Select option robotframework

Really quick (but complicated?) question.

I have this:

<select multiple="multiple" id="id_products" class="selectmultiple" name="products">
    <option value="3243">testproductP (3243)</option>
    <option value="3244">testproductQ (3244)</option>
</select>

I need to robotframework with selenium to replicate that I select an option. However I can not find a keyword like "Select Option". So I tried using "Click Element" with an xpath pointing to the option.

Click Element  xpath=//select[@name="products"]/option[@value=3244]

However this fails the test with the error: "timeout: timed out"

The xpath returns the correct element, but somehow it times out. Maybe Click Element is not supposed to be used like this, but I can't find a better keyword.

Any idea what's going on?

Upvotes: 3

Views: 29937

Answers (5)

Abhishek K
Abhishek K

Reputation: 67

Select From List By Value Xpath=""/ID=""/Name="" Value

Upvotes: 0

user197501
user197501

Reputation: 290

You can use

   Select From List  ${XPATH}    Value

Upvotes: 1

mu mj
mu mj

Reputation: 27

Try to select the element using Javascript. Example:

Execute Javascript document.querySelector("your css").click()

Upvotes: -2

Vinay Kumar Singh
Vinay Kumar Singh

Reputation: 1

Use " select element by value " keyword and specify the Xpath of the list dropdown and value of component which you want to select from list.

Upvotes: 0

Rob
Rob

Reputation: 1143

Click Element waits for a page load event unless you give it an additional parameter telling it not to wait. However, you should also be able to use the "Select From List" keyword.

Have fun!

Upvotes: 6

Related Questions