Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search and click on URL
#1
Not Solved
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: 77)
Reply
#2
Not Solved
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
Not Solved
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
Not Solved
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
Not Solved
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
Not Solved
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
Not Solved
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 866 06-29-2023, 03:11 PM
Last Post: pramod
  Search All Test scripts For a Function? AndyBSG 1 2,785 02-19-2015, 04:15 AM
Last Post: supputuri
  Right Click On a Image and Click on a Link in WebElement RameshKrishnan 4 5,478 07-10-2013, 04:13 PM
Last Post: RameshKrishnan
  Search for a string in all the files under all subdirectory Mahesh27 1 2,243 07-03-2013, 03:24 PM
Last Post: Sathiya
  Testing Search box kriday 1 2,554 06-26-2013, 08:51 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)