Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regular expression for constantly changing Image prop
#1
Solved: 10 Years, 9 Months ago
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 ?
Reply
#2
Solved: 10 Years, 9 Months ago
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")
Reply
#3
Solved: 10 Years, 9 Months ago
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
Reply
#4
Solved: 10 Years, 9 Months ago
wherever you want to put regular expression for Numeric you can use \d* which will allow any number of numeric characters
Reply
#5
Solved: 10 Years, 9 Months ago
Thanks surya I used a combination of & and \d* regular expression and it worked fine.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need Any digit in xpath path using Regular expression Priyam 1 3,269 10-05-2016, 11:05 AM
Last Post: Ankur
  Regular expression to read two words in lowercase, uppercase and with and without spa sarahq49 1 3,215 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,631 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 16,415 12-08-2014, 06:38 PM
Last Post: anshika.agarwal
  need a regular expression. anu05446 0 3,035 11-26-2014, 03:00 PM
Last Post: anu05446

Forum Jump:


Users browsing this thread: 1 Guest(s)