Problem while adding description of an object using a varibale - 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: Problem while adding description of an object using a varibale (/Thread-Problem-while-adding-description-of-an-object-using-a-varibale) |
Problem while adding description of an object using a varibale - shibinp - 08-25-2011 Dear friends, I stored set of properties of a particular object in a string variable and use that variable with WebEdit object, But it was not working. Code: StrVar="name:=USER_NAME"+""""+","+""""+"visible:=True" For me this code return an error, that object not found in the application, But it is working if i directly use StrVar as below, Code: Browser("B1").Page("P1").WebEdit("name:=USER_NAME","visible:=True").Set("Mercury") Can anyone help me to run the code successfully... Waiting for reply... RE: Problem while adding description of an object using a varibale - souvikghosh_diatm - 08-25-2011 It will not work bro..... Because the way u have initialized the variable, it means u have created a single string with two properties.... So as its a single string and dat separator comma (,) is also is a part of dat string, so QTP is not separating those two properties....its taking the full string as a single property irrespective of whether it contains comma or inverted, though its look like two different properties in run time....But for QTP its a single string property which contains those inverted commas and a comma....dats d reason y u getting object identification error.... In this case, remove the extra inverted commas dat u have added, Split dat string on basis of comma, then use dat array by position.... Like following.... Code: StrVar="name:=USER_NAME"+","+"visible:=True" now use---- Code: Browser("B1").Page("P1").WebEdit(StrVar(0),StrVar(1)).Set("Mercury") It will surely work...... Hope i am Clear to u......If not thn ping me in messanger.... ------------- Thanx. RE: Problem while adding description of an object using a varibale - shibinp - 08-25-2011 Dear Souvik, Thanks for the reply... wat i was actually trying is that, If we can directly pass it through one string variable then we could have avoid those making string array list, if condition checking etc and we can directly read form a excel sheet. if it is not possible we can leave it... Thanks, Shibin |