Forum Discussion
Its showing 502 items , but even am not able to click on the dropdown list first then i can try to select the countries from dropdown.
Please suggest if any other options.
try using below xpath instead of yours and see how it works.
//font[text()='Country of Registration :']//following::td/select
- mayursheth17 years agoContributor
Now this is selecting the dropdown but how to select the particular Country from the list?
Its datadriven activity (kept data in the excel) , Please suggest :)
what method or action need to select it?
- AlexKaras7 years agoChampion Level 3
Hi,
A bit of explanation to the code suggested by shankar_r :)
> Its datadriven activity
It is quite a usual thing for the modern web applications when regular combo-box is emulated using, for example, text box and list box elements. Those elements can be wherever within the page markup with the only thing that makes them work been a page script code (everything dependent on this or that library used by page developers).
So, the general approach is to investigate the page (with the opened combo-box) using TestComplete's Object Spy in order to figure-out actual set of UI elements you need to interact with in test code and then decide how to get those elements and how to interact with them.
This is illustrated by Shankar's code: after the click on the combo-box, assuming that it is opened, the code tries to find the UI element with the country name and click the found item.
- mayursheth17 years agoContributor
Yes ,it is now click on the list but unable to find the value from the list and throws below error:
You are trying to call the "Click" method or property of the "item" object that does not exist
- shankar_r7 years agoCommunity Hero
var page = Sys.Browser("*").Page(url); var link = page.NativeWebObject.Find("value", "<your country name>", "option"); link.Click();
i guess above will work for you.
- shankar_r7 years agoCommunity Hero
Updated code which will work for you is,
function OI() { var Page = Sys.Browser("chrome").Page("*"); Page.FindChildByXPath("//font[text()='Country of Registration :']//following::td/select").Click(); var link = Page.NativeWebObject.Find("contentText", "<your country name>", "option"); link.Click(); }
Related Content
- 2 years ago
- 5 years ago
- 6 years ago
Recent Discussions
- 2 days ago