Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data Table and descriptive programing
#11
Solved: 11 Years, 3 Months, 4 Weeks ago
Ok,
Will ask the questions 1 at a time.
1) I have a link on a web browser, the object name that is recorded takes the name of whoevr is logged in. e.g if user 5, is logged in,, the link's name in the object spy will become user 5. if i now run the script and am logged in as user 7,, the script will fail as QTP name for the object has now changed to user 7. How can I reference this object so no matter who is logged in qtp can recognise the link?
Reply
#12
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi Laura,

Step1: Use "childObjects" Method & retrieve all links(link Count) in home page(After Login)

Step2: Use For Loop & retrieve all links "innertext" value one by one & use INSTR method to check whether the "Welcome" value is contained in Link's innertext. continue the loop till required link is found.

Step3: Once the required link is found, then use "split" method with delimiter as " " (no need of "Right" method) & get the user name & you can use anywhere.


Try to implemet the above & it can be done easily.
Reply
#13
Solved: 11 Years, 3 Months, 4 Weeks ago
Thanks wil try that and let you know.
Reply
#14
Solved: 11 Years, 3 Months, 4 Weeks ago
Tried but just kept getting syntax error.. can you help me with the code pls?? my code was
Code:
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Link = Browser("Help").Page("Help").ChildObjects(oDesc)
NumbrLinks=links.Count()
Lists(i)Selecti+1
Next.

Just got stuck here.
appreciate r help.
Thanks
Reply
#15
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,
I have steps 1 and 2 working. For step 3 using the split function hwo do i split the innertext which is e.g Welcome User 10. to have just User 10.

Thanks
Reply
#16
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi ,

Lets consider the below example.

Code:
str="Welcome User 10"
x=split(str," ")              ' here x is created as an array.

find the ubound of Array x (say ubound(x)=3 i.e x(0),x(1),x(2))

x(0) will contain "Welcome"
x(1) will contain "User"
x(2) will contain "10"

Just concatenate the x(1),x(2) by using "&" operator as below
Username=x(1)&x(2)
here Username will contain "User10"

If you want a blank space to be included in username , then try as below.
Username=x(1)&" "&x(2)
here Username will contain "User 10"


You will get the "User 10"


Hope You would get it now ...Smile
Reply
#17
Solved: 11 Years, 3 Months, 4 Weeks ago
Yes mate!! Thanks a mill.
Reply
#18
Solved: 11 Years, 3 Months, 4 Weeks ago
Code:
Browser("micclass:=Browser").Page("micclass:=Page").Link("text:="Datatable("Menuitems",dtGlobalsheet")).Click

Code:
Browser("micclass:=Browser").Page("micclass:=Page").Link("text:= & Datatable("Menuitems",dtGlobalsheet)).Clic
k
Please note second solution is right
Reply
#19
Solved: 11 Years, 3 Months, 4 Weeks ago
Can anybody please make this script working.........This is related to the issue discussed in this loop. This issue is with line #11

Code:
1. Browser("QTP Forums").Page("QTP Forums").Link("Login").Click
2. Browser("QTP Forums").Page("QTP Forums").WebEdit("quick_username").Set DataTable("UserName", dtGlobalSheet)
3. Browser("QTP Forums").Page("QTP Forums").WebEdit("quick_password").Set DataTable("Password", dtGlobalSheet)
4. Browser("QTP Forums").Page("QTP Forums").WebButton("Login").Click
5. Browser("QTP Forums").Page("QTP Forums_2").Link("User CP").Click
6. A = DataTable("UserName", dtGlobalSheet)
7. Msgbox (A)
8. Set oLink = Description.create
9. oLink ("name").value="&A"
10. Msgbox (A)
11. Browser("QTP Forums").Page("User Control Panel").Link(oLink).Click
12. Browser("QTP Forums").Page("QTP Forums - Profile of").Link("Log Out").Click

Any help regarding this would be greatly appreciated....

Thanks...........
Reply
#20
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,

I feel u shud add few more property for 'oLink'. After #9 add a class property or html tag.
Code:
oLink("class").value="blablabla"
or
Code:
oLink("html tag").value="blablabla"

hope this works...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with Select checkbox from data table value jayraocourts 0 1,253 11-01-2019, 10:25 PM
Last Post: jayraocourts
  Descriptive programing kedala 1 2,747 10-04-2016, 09:25 PM
Last Post: venkatesh9032
  How to get center data value in a odd number of rows and columns web table ... sai rajesh 0 2,798 11-13-2013, 10:24 PM
Last Post: sai rajesh
  DP is not returning the whole table data content soumen 6 5,148 10-02-2013, 12:05 PM
Last Post: vvcyril
  Web Table Descriptive Language karraaruna 3 3,472 07-04-2013, 08:06 PM
Last Post: karraaruna

Forum Jump:


Users browsing this thread: 1 Guest(s)