Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search and click on URL
#1
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.

Pls see the attachment.

Thank you
Z
[attachment=525]

.zip   QTP.zip (Size: 112.17 KB / Downloads: 119)
Reply
#2
Hi
You can use DP to get all links in the page and click on 1st link by using the index as 0.
OR
try for last statement as:
Code:
Browser("Officeworks | Officesupplies,").Page("Officeworks | Officesupplies,_2").Link("index:=0").Click
If this didn't work and if the link name begins with "Officeworks", then try with
Code:
Browser("Officeworks | Officesupplies,").Page("Officeworks | Officesupplies,_2").Link("name:=Officeworks.*,index:=0").Click

Please let me know if u get any problem.
Reply
#3
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 Smile
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.
Sad
Z
Reply
#4
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
Reply
#5
Hi Kobita,
Thank you for trying to help me. This is how the script look -

Code:
Browser("Officeworks | Office Supplies,").Page("Officeworks | Office Supplies,").Sync Browser("Officeworks | Office Supplies,").Page("Officeworks | Office Supplies,").WebEdit("query").Set "PPS142380" Browser("Officeworks | Office Supplies,").Page("Officeworks | Office Supplies,").Image("Search").Click 32,6 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.

Cheers
Z
Reply
#6
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.
Reply
#7
Sad 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.


Attached Files Image(s)
   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CyberArk CorePAS REST API to search for accounts pramod 0 1,238 06-29-2023, 03:11 PM
Last Post: pramod
  Search All Test scripts For a Function? AndyBSG 1 3,279 02-19-2015, 04:15 AM
Last Post: supputuri
  Right Click On a Image and Click on a Link in WebElement RameshKrishnan 4 6,219 07-10-2013, 04:13 PM
Last Post: RameshKrishnan
  Search for a string in all the files under all subdirectory Mahesh27 1 2,608 07-03-2013, 03:24 PM
Last Post: Sathiya
  Testing Search box kriday 1 2,958 06-26-2013, 08:51 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)