10-21-2010, 08:31 AM (This post was last modified: 10-21-2010, 08:39 AM by Z_Melb.)
Hi All,
How do I search for a list of products by their ID and make QTP to click on their respective URLs? I can add the products in Datatable and able to search for the given products but I cannot make QTP to click on the changing URLs. Every time a new product is searched, the URL will change.
I have been trying to make this work but going no where.
I would really appreciate anyone's help as I need this for work purpose.
Hi Kavita,
thank you very much for your reply.
i like to mention here that, i am a new user in QTP. So you might have to be little descriptive please
What is DP that you mentioned?
I tried your 2nd solution, it can search for the list of products from Datatable but does not CLICK on the individual URLs.
The 3rd solution didn't work.
Sorry, DP >> Descriptive Programming
Add these lines after your second line i.e, after search action
Code:
set Ldesc=Description.create()
Ldesc("micclass").value="Link"
Ldesc("name").value="Officeworks.*"
set objWebLink=Browser("Officeworks | Officesupplies,").Page("Officeworks | Officesupplies,_2").ChildObjects(Ldesc)
If objWebLink.Count>0 Then
' As i am seeing the link with that name is only one on the page, i am using 1st link to click as:objWebLink(0)
objWebLink(0).Click
End If
set Ldesc=Description.create()
Ldesc("micclass").value="Link"
Ldesc("name").value="Officeworks.*"
set objWebLink=Browser("Officeworks | Officesupplies,").Page("Officeworks | Officesupplies,_2").ChildObjects(Ldesc)
If objWebLink.Count>0 Then
objWeblink(0).click
end if
Browser("Officeworks | Office Supplies,").Page("Officeworks | Office Supplies,_2").Link("Pack Post Send Envelopes").Click
But, when i run the script i get an error "The "Officeworks | officesupplies," browser object was not found in the object repository. Check the boject repository to confirm that the object exists or to find the correct name for the object."
Do I have to create object repository? I dont have any.
10-22-2010, 09:58 AM (This post was last modified: 10-22-2010, 09:58 AM by KavitaPriyaCR.)
Sorry, Please write as:
Code:
set Ldesc=Description.create()
Ldesc("micclass").value="Link"
Ldesc("name").value="Officeworks.*"
set objWebLink=Browser("Title:=Officeworks | Officesupplies,").Page("Title:=Officeworks | Officesupplies,_2").ChildObjects(Ldesc)
If objWebLink.Count>0 Then
objWeblink(0).click
end if
I forgot to mention Title for Browser and Page, pls let me know.
No luck, get an error. Pls see the attachment.
Do you have an example that I can use, where you can search for something and able to click on the first result that displays? As you know, there will be a list of things to search, so the first result will always change based on the search.
Thank you for helping me.