108. What Is Regular Expression How Will U Implement It?
Date Posted: 06/27/2012
Ans: Let us take yahoo Site as an example. Then the script will
be something like:
Browser ("Yahoo! Mail - The best").Page ("Yahoo! Mail - The
Best").Web Edit ("login").Set "Test User"
Browser ("Yahoo! Mail - The best").Page ("Yahoo! Mail - The
Best").Web Edit("password").Set Secure "460205b87f0543"
Browser ("Yahoo! Mail - The best").Page ("Yahoo! Mail - The
Best").Web Button ("Sign In").Click
Browser ("Yahoo! Mail - The best").Page ("Yahoo! Mail -
Test User@").Link ("Addresses").Click
Browser ("Yahoo! Mail - The best").Page ("Yahoo! Address
Book -").Link ("Mail").Click
Browser ("Yahoo! Mail - The best").Page ("Yahoo! Mail -
Test User").Sync
Here the page title is continuously changing. But, all
Titles contain "Yahoo!"
When ever, you click on any tabs, i.e. (mail, compose,
Addresses, etc), the page title changes. But, still
Contains "Yahoo!" as part of the string. In this case, we
Can use regular expression (while using descriptive
Programming):
Browser ("Yahoo! Mail - The best").Page
("Class Name: =Page", "title: =Yahoo.*").Web Edit
("Class Name: =Web Edit", "Name:=login").Set "Test User"
|