Micro Focus QTP (UFT) Forums
How to have a variable that has a string comma string .. - 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: How to have a variable that has a string comma string .. (/Thread-How-to-have-a-variable-that-has-a-string-comma-string)



How to have a variable that has a string comma string .. - shareq1310 - 11-05-2011

Code:
COMMA = chr(34) & "\," & chr(34)

'HTML Tags


Browser_ComplianceLink = "title:=Compliance.*"
Page_ComplianceLink = "title:=Compliance.*"
HTMLTagINPUT = "INPUT"
WE_Username = "type:=text"&COMMA&"name:=username"&COMMA&"html Tag:=INPUT"

Browser(Browser_ComplianceLink).Page(Page_ComplianceLink).WebEdit(WE_Username).Set "Shareq"    '---- not working



I have isolated the error and the variable WE_Username does not work. It was working yesterday but today it seems to be throwing an error saying the webedit box is not found.

Any help or suggestion is appreciated


RE: How to have a variable that has a string comma string .. - ravi.gajul - 11-05-2011

Check if the webEdit properties have changed.


RE: How to have a variable that has a string comma string .. - shareq1310 - 11-07-2011

I checked that, but how can I define a descriptive programming text in a variable and then use that variable in the statement

Code:
Browser.Page.WebEdit(variable).set "myName"



RE: How to have a variable that has a string comma string .. - ravi.gajul - 11-08-2011

Use it like this

Code:
Browser_ComplianceLink = "Compliance.*"
Page_ComplianceLink = "Compliance.*"
strType = "text"
strName="username"
strTag="INPUT"

Browser("title:="&Browser_ComplianceLink).Page("title:="&Page_ComplianceLink).WebEdit("html tag:="&strTag,"type:="&strType,"name:="&strName).Set "Shareq"

Hope this answers your question

Regards,
Ravi


RE: How to have a variable that has a string comma string .. - shareq1310 - 11-08-2011

Thanks Ravi, but I want to use the variable myVar instead. When I write it this way it gives me errors and the code does not execute.

Code:
myVar = "html tag:="&strTag,"type:="&strType,"name:="&strName
Browser("title:="&Browser_ComplianceLink).Page("title:="&Page_ComplianceLink).WebEdit(myVar).Set "Shareq"



RE: How to have a variable that has a string comma string .. - parminderdhiman84 - 11-09-2011

i hav not debugged it but one of these should work for u:

Code:
myVar =""type:=text""&","&""name:=username""&","&""html Tag:=INPUT""
or
Code:
myVar =""type:=text""&"",""&""name:=username""&"",""&""html Tag:=INPUT""

Code:
Browser("title:="&Browser_ComplianceLink).Page("title:="&Page_ComplianceLink).WebEdit(myVar).Set "Shareq"