Micro Focus QTP (UFT) Forums
Descriptive programming variable issue - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Descriptive programming variable issue (/Thread-Descriptive-programming-variable-issue)



Descriptive programming variable issue - pooja7 - 02-17-2012

Hi All,

There are 3 Add buttons on my screen; so using Descriptive programming; If I write and execute the following line of code to click the 2nd Add button :

Code:
Browser("Test").Page("Test").Frame("Test").WebButton("name:=Add","index:=1").Click

Above line works perfectly well...

But when I write the following

Code:
strVariable= "name:=Add"",""index:=0"
--- including double - double quote in between as i need QTP to understand double quote literally

Browser("Test").Page("Test").Frame("Test").WebButton(strVariable).Click


It just does not work! - I have tried most of the the permutations and combinations with the quotes.
Any ideas on how to accomplish this?

Regards
Pooja


RE: Descriptive programming variable issue - inborntester - 02-17-2012

can you try to add \ infront of first ".


RE: Descriptive programming variable issue - pooja7 - 02-17-2012

Nope, doesnt work with that ; tried with both:

Code:
strVariable= "name:=Add/"",""index:=0"
and

Code:
strVariable= "name:=Add/"",""/index:=0"

Thanks


RE: Descriptive programming variable issue - inborntester - 02-17-2012

i am wonder with ""index:=0" its generally as "Propery:=value" means that "index is a property? can u chk it.




RE: Descriptive programming variable issue - pooja7 - 02-20-2012

Checked - its working when I put
Code:
Browser("Test").Page("Test").Frame("Test").WebButton("name:=Add","index:=1").Click

it works fine
only when i put it in a variable - then there's a problem.

Code:
strVariable= "name:=Add"",""index:=0"

so its not index related


RE: Descriptive programming variable issue - simon_schreiner - 02-29-2012

Just tried something and think I found the solution.
What worked for me was using 3 " at the beginning and the end of the String
example:
Code:
strVariable = """name:=queryall"",""type:=text"""
Browser("IP Startseite").Page("IP Startseite").WebEdit(strvariable).Set "def"

Hope it works for you too.

edit: forgot to use code tags, sry for that