문제

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?

도움이 되었습니까?

해결책

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!

다른 팁

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.

You can use

   Select From List  ${XPATH}    Value

Try to select the element using Javascript. Example:

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top