Thanks a lot for your time. still having problem. pls see attached if that helps you why i am getting the error.
regular expression
|
10-06-2010, 04:17 AM
Looks to me like this is getting too complicated. When you were doing the inline descriptive programming, you were not closing the strings and passing each property as a parameter:
Code: Browser("micclass:=Browser").Page("micclass:=Page").Frame("micclass:=Frame").Link("micclass:=Link,html tag:=a,text:=(Junk)$|Junk[\d\)\(]+").Click Should be like this: Code: Browser("micclass:=Browser").Page("micclass:=Page").Frame("micclass:=Frame").Link("micclass:=Link", "html tag:=a", "text:=(Junk)$|Junk[\d\)\(]+").Click That being said, I think that the expression is not taking in to account what appears to be a space between the "Junk" and the number. I think the expression can be greatly simplified as well: Code: Browser("micclass:=Browser").Page("micclass:=Page").Link("html tag:=A", "text:=Junk( \(\d+\))?").Click This expression says "click the link that has the text 'Junk' that may or may not be followed by the expression ' \(\d+\)' which says the text '<one space><one left parenthesis><one or more digits><one right parenthesis>'" Hope this helps!
10-06-2010, 02:37 PM
When using multiple descriptors, try the following:
Code: Browser("micclass:=Browser").Page("micclass:=Page").Frame("micclass:=Frame").Link("micclass:=Link","html tag:=a","text:=(Junk)$|Junk[\d\)\(]+").Click Note, the quotes are given between each attribute. Also, in object identification, add other properties name, innertext, outertext, visible as well. Delete the object inbox() added in object repository, and again add it to OR with these properties. Make sure you check 'regular expression' checkbox in the properties of the object in OR. Try with the value Inbox ([0-9].*) in Value configuration options of the property in OR, and do not set '\' backslash. Set Regular expression checkbox. With all this set, try with Code: Browser("micclass:=Browser").Page("micclass:=Page").Frame("micclass:=Frame").Link("innertext:=Inbox ([0-9].*)").Click
Thanks .
I am still having same problem. Pls see attached. I had: Code: Browser("micclass:=Browser").Page("micclass:=Page").Frame("micclass:=Frame").Link("micclass:=Link","html tag:=a","text:=(Junk)$|Junk[\d\)\(]+").Click One thing I noticed that Inbox/Junk both has a html tag = A. I am doing it in hotmail as i said. If you can do the same in hotmail, i dont know why i cant do it. Thanks. one improvement. i added one more property. Code: Browser("micclass:=Browser").Page("micclass:=Page").Link("micclass:=Link","html tag:=A","abs_y:=267", "text:=Junk( \(\d+\))?").Click this code works, if Junk folder has any number(ex: Junk(1), Junk(2)), it clicks. But if Junk folder has no number, no parenthesis, then it gives me error. ex: Junk Pls help. thx.
10-06-2010, 10:34 PM
When Junk folder was empty, using object spy, i found Junk text value was : Junk ()
When Junk folder had one email, using object spy, i found Junk text value was : Junk (1) Just letting you know. Thanks.
10-07-2010, 01:07 AM
(This post was last modified: 10-07-2010, 01:08 AM by cdesserich.)
Ah ha! That's the trick then! I thought that when there was nothing in the folder, the parenthesis and digits would both be gone. try:
Code: Browser("micclass:=Browser").Page("micclass:=Page").Link("html tag:=A", "text:=Junk \(\d*\)").Click This says: click the link that has the text "Junk (" that may have zero to many digits followed by the text ")". Also, when doing inline descriptive programming, you do not have to call out the micclass property since it is implied by the fact that you are calling the Link() function. We only use it for Browser and Page as dummy properties so that we get back the only Browser with any Page on it (i.e no identification properties).
10-07-2010, 08:52 PM
You are awesome. Now it works. Many thanks.
When you have a chance, can you explain me the following expressions? "text:=(Junk)$|Junk[\d\)\(]+") //what the dollar and plus sign for? "text:=Junk( \(\d+\))?") //here what is the question mark meaning? Also, do you have any messenger/email so i can ask you more questions?
10-08-2010, 09:35 PM
Code: (Junk)$|Junk[\d\)\(]+ Code: (Junk)$ Code: Junk[\d\)\(]+ So, (whew!) the expression says: match the text "Junk" with no characters after it OR match the text "Junk" with one or more characters after it that could be a digit, a left parenthesis, or a right parenthesis. I explained the "Junk( \(\d+\))?" expression in my post, but I guess I wasn't perfectly clear on the question mark. The question mark means that the expression in the parenthesis grouping may or may not be there. cdesserich Wrote:This expression says "click the link that has the text 'Junk' that may or may not be followed by the expression ' \(\d+\)' which says the text '<one space><one left parenthesis><one or more digits><one right parenthesis>'" That's where I was confused before, I thought that when the junk folder was empty the link text would simply be "Junk". So the "Junk( \(\d+\))?" expression will match "Junk" or "Junk (<one or more digits>)". We needed an expression that matched "Junk (<zero or more digits>)" which is why "Junk \(\d*)\)" works. The "*" operator means "zero or more". Please see Ankur's post about this subject, Regular Expressions Regularized, right here on this site! I have this post bookmarked and use it very frequently as a resource when figuring out regular expressions. There are other good tools out there as well. Another one I use is The RegEx Coach which is a program that helps visualize how regular expressions work. It is free, has great documentation, and good tutorials. Good Luck! P.S. the email link at the bottom of my posts should work fine, but if questions are asked in a public forum like this, then everyone can benefit from the information shared. I am far from being an expert at regular expressions, I struggle with them a lot, like most people. |
« Next Oldest | Next Newest »
|
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,576 |
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 |
Users browsing this thread: 11 Guest(s)