Forum Discussion
Pavel_1
15 years agoContributor
Hi,
As I understand all these '+' icons have no unique property (except for ID which is changed dynamically), and they have the same parent object (I mean all these icons are under a.parent and that's why you can click wrong icon each time).
You can try to search needed icon by its Y coordinate (it may be "Top", "ScreenTop" or some another property defining vertical coordinate), taking into account that it should be on the same level as "demo" folder.
So you should find all objects with "namePropStr" property equal to "plus.gif" and take the one which has "Top" property approximately equal "demo" item's Top property (taking into account that "+" icon may be shifted by several pixels in comparison to "demo)
Let's take that your icon is on the same level as "demo" +- 5 pixels, then the code will be like this:
all = page.document.frames.ifmfolder.document.all;
a = page.NAtiveWebObject.Find("outerText","demo");
icons = a.parent.FindAll("namePropStr","plus.gif", 1);
icons = VBArray(icons).toArray();
for (var i=0; i<icons.length; i++)
{
if ((icons.Top>a.Top-5)&&(icons.Top<a.Top+5))
{icon = icons; break}
}
icon.Click();
As I understand all these '+' icons have no unique property (except for ID which is changed dynamically), and they have the same parent object (I mean all these icons are under a.parent and that's why you can click wrong icon each time).
You can try to search needed icon by its Y coordinate (it may be "Top", "ScreenTop" or some another property defining vertical coordinate), taking into account that it should be on the same level as "demo" folder.
So you should find all objects with "namePropStr" property equal to "plus.gif" and take the one which has "Top" property approximately equal "demo" item's Top property (taking into account that "+" icon may be shifted by several pixels in comparison to "demo)
Let's take that your icon is on the same level as "demo" +- 5 pixels, then the code will be like this:
all = page.document.frames.ifmfolder.document.all;
a = page.NAtiveWebObject.Find("outerText","demo");
icons = a.parent.FindAll("namePropStr","plus.gif", 1);
icons = VBArray(icons).toArray();
for (var i=0; i<icons.length; i++)
{
if ((icons.Top>a.Top-5)&&(icons.Top<a.Top+5))
{icon = icons; break}
}
icon.Click();
Related Content
Recent Discussions
- 26 minutes ago
- 2 days ago