I'm using selenium IDE, and I received an error when trying to select an option in a drop down menu. The error message:
Element name = aggravation [] 556 [shares] not found.
This the command in question
|select| |name=aggravation[]556[shares] |label=2|
and this is the source code
<select name="aggravation[]556[shares]" id="aggravation_556_shares" class="shares" data-id="556" style=""><option selected="selected" value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
Why am I getting this error? Is my code wrong?
1 Answer 1
Maybe the [] are giving issues, the error also shows spaces between them, which I think is weird.
Better selector:
I would try to use the id or css instead:
id=aggravation_556_shares
or
css=select.shares
Read more about selectors here: http://www.guru99.com/locators-in-selenium-ide.html
Visible:
Are you certain the element is visible when you try to find it? Maybe the page is just a bit (milliseconds) slower than your test. You might need to wait until the element is visible. Example here: https://stackoverflow.com/questions/26341758/how-to-wait-until-element-present
-
I tried what you wrote down but still it does not work for me, about the time I need to wait how do I know what to put in terms of the waitDaniel Shmayovich– Daniel Shmayovich2017年02月28日 12:32:44 +00:00Commented Feb 28, 2017 at 12:32
-
Can't you use the recorder of the IDE and see what kind of code it generates? I haven't used Selenium IDE in years, don't really know, just wanted to suggest you some directions. Read the documentation? :)Niels van Reijmersdal– Niels van Reijmersdal2017年02月28日 15:18:31 +00:00Commented Feb 28, 2017 at 15:18
-
Yes I use the recording, and read the document. I also did something similar in C # that can help that where I get the same error . newSelectElement(driver.FindElement(By.Id("aggrupations_556_shares"))).SelectByText("3");Daniel Shmayovich– Daniel Shmayovich2017年02月28日 15:38:11 +00:00Commented Feb 28, 2017 at 15:38