Micro Focus QTP (UFT) Forums
Regular expression for constantly changing Image prop - 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: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: Regular expression for constantly changing Image prop (/Thread-Regular-expression-for-constantly-changing-Image-prop)



Regular expression for constantly changing Image prop - sunny rao - 11-19-2008

Hi Ankur and all,

I am using descriptive programming for a Image button which is embedded in web table which in turn is embedded in wbfgrid, every scenario the value of text changes .

properties of all Image buttons are similar except text, name, therefore used for DP.

Scenario 1:
Code:
Browser("Accelrated Login").Page("Acced_config"").Webtable("bdl_propty").wbfgrid("name:=xyz","text:=bdl").Image("innertext:=dllproductPanel1$ctl00_$ctl01$_abcd")
Same button Scenario2:
Code:
Browser("Accelrated Login").Page("Acced_config"").Webtable("bdl_propty").wbfgrid("name:=xyz","text:=bdl").Image("innertext:=dllproductPanel1$ctl00_$ctl02$_abcd")

How can we use regular expression, in this case where if you notice the number "01", "02" depends on the rows dynamically obtained in the scenario.

For example : if there are 2 rows I have to click on Image button the innertext will be "........$ctl01$......", If there are 3 rows in wbfgrid and I have click on Image button the innertext will be "........$ctl02$......".

How can we split the text and then pass the value. or use reg expression to do this ?


RE: Regular expression for constantly changing Image prop - surya_7mar - 11-29-2008

if you know the row number you can either specify like
i = "01" ' row number
Code:
Browser("Accelrated Login").Page("Acced_config"").Webtable("bdl_propty").wbfgrid("name:=xyz","text:=bdl").Image("innertext:=dllproductPanel1$ctl00_$ctl" & i & "$_abcd")



RE: Regular expression for constantly changing Image prop - sunny rao - 12-08-2008

Hi surya,

Thank you for the suggestion. it will reduce many lines of code. The products changes for different scenarios and their order also changes : - For example i=01 for first test case and same product has i=03 in second test case. Also the value before that Ctl 100 might change
Is there any way I put reg expression

*.\ctl&i.*

some thing like that: - to use only value "Ctl &i&" as literal and remaining everything as reg exp


RE: Regular expression for constantly changing Image prop - surya_7mar - 12-16-2008

wherever you want to put regular expression for Numeric you can use \d* which will allow any number of numeric characters


RE: Regular expression for constantly changing Image prop - sunny rao - 12-26-2008

Thanks surya I used a combination of & and \d* regular expression and it worked fine.