Find and FindAll methods
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2010
06:59 AM
03-16-2010
06:59 AM
Find and FindAll methods
Hi all,
I am trying to find a group of objects. This is my code:
Dim PropNames, PropValues, Download_Build
PropNames = Array("innerHTML")
PropValues = Array("Archive Files")
Download_Build = NameMapping.FindAll(PropNames, PropValues, 1000, True).href
Log.Message(Download_Build(0))
At first, I tried the Find method instead of FindAll, which returned me the last object of the group. But I want the first object, so I used the FindAll method. The problem is when I run the FindAll method, I get the following error message:
Object required: 'NameMapping.FindAll(...)'
Unit: "Unit1" Line: 71 Column: 3.
I have read the documentation, but it seems I should be able to use the FindAll method the same way than the Find method.
Any hints would be greatly appreciated.
Benoit
I am trying to find a group of objects. This is my code:
Dim PropNames, PropValues, Download_Build
PropNames = Array("innerHTML")
PropValues = Array("Archive Files")
Download_Build = NameMapping.FindAll(PropNames, PropValues, 1000, True).href
Log.Message(Download_Build(0))
At first, I tried the Find method instead of FindAll, which returned me the last object of the group. But I want the first object, so I used the FindAll method. The problem is when I run the FindAll method, I get the following error message:
Object required: 'NameMapping.FindAll(...)'
Unit: "Unit1" Line: 71 Column: 3.
I have read the documentation, but it seems I should be able to use the FindAll method the same way than the Find method.
Any hints would be greatly appreciated.
Benoit
7 REPLIES 7
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2010
04:52 AM
03-18-2010
04:52 AM
Any ideas?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2010
04:09 AM
03-19-2010
04:09 AM
Hi Benoit,
The difference between the FindAll and Find methods is that the FindAll method returns an array of objects and the Find method returns the first found object in the object tree. You get the error message because you are trying to get the value of the href property of the resulting array. You cannot use the href property in such a way. Here's the corrected script:
BTW, you can reduce the search time when searching for objects by using the FindAll method of a known parent object.
The difference between the FindAll and Find methods is that the FindAll method returns an array of objects and the Find method returns the first found object in the object tree. You get the error message because you are trying to get the value of the href property of the resulting array. You cannot use the href property in such a way. Here's the corrected script:
Dim PropNames, PropValues, Download_Build
PropNames = Array("innerHTML")
PropValues = Array("Archive Files")
Download_Build = NameMapping.FindAll(PropNames, PropValues, 1000, True)
Log.Message(Download_Build(0).href)
BTW, you can reduce the search time when searching for objects by using the FindAll method of a known parent object.
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2010
02:28 AM
03-22-2010
02:28 AM
Now that you explain it, it makes a lot of sense.
Thanks a lot David !
Thanks a lot David !
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2010
10:08 AM
04-05-2010
10:08 AM
Hi again,
I have tried David's solution and it works fine.
I am trying to optimize the code to search only in IE and not the whole system (it's pretty slow).
When changing to:
Download_PCC_Build = iexplore.NameMapping.FindAll(PropNames, PropValues, 1000, True)
I get a mismatch error. I tried adding "Set" before the line, adding brackets, but without luck.
Any clues?
I have tried David's solution and it works fine.
I am trying to optimize the code to search only in IE and not the whole system (it's pretty slow).
When changing to:
Download_PCC_Build = iexplore.NameMapping.FindAll(PropNames, PropValues, 1000, True)
I get a mismatch error. I tried adding "Set" before the line, adding brackets, but without luck.
Any clues?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2010
06:57 PM
04-05-2010
06:57 PM
Hi Benoit,
I suspect that you need to use the 'NameMapping.iexplore' object instead of 'iexplore.NameMapping':
To know the object name for sure, open the Name Mapping editor (see the "Name Mapping Editor" article for more information), find the 'iexplore' object in the Name Mapping scheme, copy its full name and paste it to the script.
I suspect that you need to use the 'NameMapping.iexplore' object instead of 'iexplore.NameMapping':
Download_PCC_Build =NameMapping.iexplore.FindAll(PropNames, PropValues, 1000, True)
To know the object name for sure, open the Name Mapping editor (see the "Name Mapping Editor" article for more information), find the 'iexplore' object in the Name Mapping scheme, copy its full name and paste it to the script.
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2010
03:23 AM
04-06-2010
03:23 AM
Thanks David for the answer.
NameMapping.iexplore does not seem to work either. (Object doesn't support this property or method: 'NameMapping.iexplore')
The application I am testing is dynamic, it keeps changing object names, I don't have a choice to use NameMapping.
Any more clues?
Thanks in advance :).
NameMapping.iexplore does not seem to work either. (Object doesn't support this property or method: 'NameMapping.iexplore')
The application I am testing is dynamic, it keeps changing object names, I don't have a choice to use NameMapping.
Any more clues?
Thanks in advance :).
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2010
10:19 PM
04-07-2010
10:19 PM
Hi Benoit,
Most probably, you need to use the 'NameMapping.Sys.iexplore' object. To know the object name for sure, you need to refer to the Name Mapping editor as I described in my previous post.
If you still have any problems, please zip your entire project suite folder and send us the archive via our Contact Support form.
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
