Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I send variable value to html property for descriptive programming in QTP
#1
Not Solved
Hi All,

Please can any body tell me How can I send variable value for HTML property for descriptive programming in QTP.

e.g.
Code:
Dim testid, i,j
i=1
j = Cstr(i)
testid = "Edit"+j

Browser(browsers).Page(pages).WebButton("html tag:=Input", "html ID:=testid").Click

Here i is variable. But when am sending testid as a value to html ID , its throwing me error , I guess there is some string error because of double qoutes. Can any body help me to resolve this problem.

Thanks,
Ritu
Reply
#2
Not Solved
Hi Ritu,

You can send a value to a html property by using & symbol.
_____________
Code:
name = "Login"
Browser("name:=name").Page("page:=p").webbutton("name:="&name).click
______________

But I dunno how to use more than one property (like using html tag and html id, that u hav used in your LOC) in descriptive programming. If anybody know, Please let me know.

Thanks,
Reply
#3
Not Solved
Hi Ritu,

Code:
Browser(browsers).Page(pages).WebButton("html tag:=Input", "html ID:=" & testid).Click

that's it.
Remember one thing use "&" for concatenation of two expressions once the string is closed.

@QTPian : we can use the same syntax for ever more than one property.

Let me know if you need any more info.
Thanks,
SUpputuri
Reply
#4
Not Solved
Hi QTPKing..

Thanks for your reply. But the same is not working for me.. I am getting the following error message,
"Cannot identify the object "[ WebButton ]" (of class WebButton). Verify that this object's properties match an object currently displayed in your application."

here is my code,
Code:
Systemutil.Run "iexplore.exe", "http://www.bing.com"
Dim testid
testid = "sb_form_go"
Browser("name:=Bing").Page("title:=Bing").WebButton("html tag:=INPUT,  html id:="&testid).Click

Please let me know of the issues in the same.

Thanks,
Reply
#5
Not Solved
Hi QTPian,

Check out the below LOC and let me if you need any more info.

Code:
btnName = "Google Search"
Browser("Google").Page("Google").webbutton("html tag:=INPUT","name:=" & btnName).highlight
Thanks,
SUpputuri
Reply
#6
Not Solved
Thanks QTPKing.. When the "name" property is used, the script is working fine. But the combination of "html tag" and "html id" is not working. I dunno why it is not working.. Any comments on this?
Reply
#7
Not Solved
Thanks buddies,
Thanks a lot for ur help. It(WebButton("html tag:=Input", "html ID:=" & testid)) worked for me.

Regards
Ritu
Reply
#8
Not Solved
Hey Guys, I got the issue in my LOC. The working code is
------
Code:
Browser("name:=Bing").Page("title:=Bing").WebButton("html tag:=INPUT", "html id:="&testid).Click
----------
instead of which I was trying with
--------
Code:
Browser("name:=Bing").Page("title:=Bing").WebButton("html tag:=INPUT, html id:="&testid).Click
--------
and continuously got the error message.

Thanks,
Reply
#9
Not Solved
Hi QTPian,

I think you are ok with the code now. The only thing is we should close one property and then define the other property then only it will work.

Let me know you need any info.
Thanks,
SUpputuri
Reply
#10
Not Solved
Thanks QTPKing.. Its working... Thanks once again for explaining in detail...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP Not Recognising Delphi Name Property richardeth 0 2,084 01-30-2014, 09:57 PM
Last Post: richardeth
  capture screenshot using html code and view in QTP Test results Bhuvan 3 7,223 07-19-2013, 02:38 PM
Last Post: Bhuvan
  Not able to send spacebar with End Key to TE nbansal 1 3,627 02-08-2013, 11:31 PM
Last Post: coolguy
  fucntion to send mail in outlook works fine in qtpcode but does not work in .vbs Rashmi 2 4,072 06-13-2011, 09:55 PM
Last Post: byzoor
  Send mails through QTP tester_rahul 2 3,032 04-29-2010, 01:50 PM
Last Post: tester_rahul

Forum Jump:


Users browsing this thread: 2 Guest(s)