Hi
i have tried this code to select a value from dropdown but it is not working for me
WebDocument webdoc = "/dom[@caption='pagecaption']";
SelectTag cngcntry = webdoc.FindSingle(".//select[@id='idvalue']");
cngcntry.Click();
Delay.Seconds(2);
ListItem item = "/container[@caption='selectbox']/listitem[@innertext='itemtext']";
item.Click();
i get the error "Ranorex.ElementNotFoundException: No element found for path '/container[@caption='selectbox']/listitem[@innertext='textvalue']' within 5000ms. at Ranorex.Core.Element.FindSingle(RxPath path, Duration timeout) at Ranorex.Core.Element.op_Implicit(String path) at Ranorex.ListItem.op_Implicit(String path) at sdsfg.Program.Main(String[] args)
Not able to select an item from dropdown in web
Re: Not able to select an item from dropdown in web
Are you setting a value for "itemText"?
Your code should be written such that itemText is used as a variable like so:
And you need to set itemtext to a valid list item.
Also make sure that "selectbox" is the proper object name of your container.
Your code should be written such that itemText is used as a variable like so:
Code: Select all
ListItem item = "/container[@caption='selectbox']/listitem[@innertext='" + itemtext + "']";
Also make sure that "selectbox" is the proper object name of your container.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Not able to select an item from dropdown in web
Hi
it is working fine with the below code ...
ListItem item = "/container[@caption='selectbox']/listitem[@accessiblename='" + itemtext + "']";
not sure why it is not working with innertext .....
Thanks
Kiran Pol
it is working fine with the below code ...
ListItem item = "/container[@caption='selectbox']/listitem[@accessiblename='" + itemtext + "']";
not sure why it is not working with innertext .....
Thanks
Kiran Pol
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Not able to select an item from dropdown in web
I guess because the element does not have an attribute with that name. You can only use those attribute that are listed for that element in Ranorex Spy when you track it.kiran.pol wrote:not sure why it is not working with innertext .....
Please, have a look at the Ranorex User Guide:
http://www.ranorex.com/support/user-gui ... apter.html
Regards,
Alex
Ranorex Support Team