Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
regular expression
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,

I am doing regression testing. When i record the web application, i see in inbox(6). I clicked on inbox(6). Then i run the script, it fails on inbox(6) step because inbox(6) became inbox in web application.

To solve it, i put regular expression statement as follows: inbox\([0-100]\). it fails. If i have inbox(0) or inbox(1),.. it passes. but it fails because web application shows: inbox. No number next to it.

Someone pls help me. Thanks.

safiullah12@hotmail.com
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Try:

inbox[\d]?
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
i tried inbox[\s]
inbox[\d]

still getting error message-says objects properties match an object currently displayed in your application....
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Yes, I failed to notice the parenthesis the first time, try:

(inbox)$|inbox[\d\)\(]+
Reply
#5
Solved: 11 Years, 3 Months, 4 Weeks ago
when i go to object properties, i see text, innerhtml, and html tag. I did reg expression only for text. Do i need to do reg expression for innerhtml too? Innerhtml shows:<SPAN class=caption....inbox...6..,/SPAN>

thx.
Reply
#6
Solved: 11 Years, 3 Months, 4 Weeks ago
You can use any of the values. I recommend which ever property is shorter and the most unique so the RegExp is less complex. You can use the html tag and descriptive programming to limit the number of objects to view as well.
Code:
Browser().Page().Link("micclass:=Link,html tag:=a,text:=(inbox)$|inbox[\d\)\(]+").Click

That should only click on a Link (<a> tag) with text of inbox or inbox(x). Shouldn't be many of those on the page.
Reply
#7
Solved: 11 Years, 3 Months, 4 Weeks ago
Now I am doing for Junk folder. I had 64 emails in junk folder when i recorded. I deleted all. Before junk folder looked like this: Junk(64). Now it looks like: Junk
object properties shows:
Code:
text =  (Junk) $|Junk[\d\)\(]+
innerhtml = inline">(<SPAN>64</SPAN>)</SPAN></SPAN>

Cant pass the step. Thanks in advance.
Reply
#8
Solved: 11 Years, 3 Months, 4 Weeks ago
Should work. I noticed the span tags in your Junk description. I wouldn't think that would come over as part of the text, but if it is, then the expression needs to be adapted to allow it. You can try using:

Code:
msgbox Browser().Page().Link(your link).TOProperty("Text")

That will display the text for the link so you can verify any additional text needed for your expression.

Also check for a space between (Junk) and $. Your post shows one.
I would really try to use the HTML ID tag instead of the text. You are obviously doing some sort of email application and the link text can change, but the HTML ID should always be the same. View the source of the page and see if it has an ID you can use.
Reply
#9
Solved: 11 Years, 3 Months, 4 Weeks ago
Code:
Browser("micclass:=Browser").Page("micclass:=Page").Frame("micclass:=Frame").Link("micclass:=Link,html tag:=a,text:=(Junk)$|Junk[\d\)\(]+").Click
this is i wrote. I get error saying "object does not support this property.... "

let me try using msgbox ..
Reply
#10
Solved: 11 Years, 3 Months, 4 Weeks ago
It's been my experience that when using multiple descriptors, it better to use a Description object.

Code:
dim desc, link
set desc = Description.Create()
desc("html tag").value = "a"
desc("micclass").value = "Link"
desc("text").value = "(Junk)$|Junk[\d\)\(]+"
Browser().Page().Link(desc).Click

Should work the same either way though.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need Any digit in xpath path using Regular expression Priyam 1 3,495 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,361 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,830 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 16,577 12-08-2014, 06:38 PM
Last Post: anshika.agarwal
  need a regular expression. anu05446 0 3,123 11-26-2014, 03:00 PM
Last Post: anu05446

Forum Jump:


Users browsing this thread: 10 Guest(s)