Hi
Try like following example...
We have command called ".exist" search for help on QTP, you will find more
examples...
I am giving one example...
Example 1: If we have objects recorded and stored in object repository
this works
If browser ("yahoo").exist then
Browser("yahoo").page ("yahoo").webedit("Username").set "yourname"
Else
Reporter.ReportEvent "Fail" , "unable to identify yahoo browser"
End if
example2:
If objects are not stored in Object repository and text contains some words
like
\ or " or ' and if you are using descriptive programming we have to use ".*"
before to special characters and special characters have to be removed.. As
shown below
Browser("Google's").Page("Google's).webedit("q").set "yourname"
We can also write the same using descriptive programming as shown below.
Browser("name:=Google.*").page("title:=Google.*").webedit("name:=q").set
"yourname"
When we want to test before it exists or not we can also write as shown
below.
If Browser("name:=Google.*").exist then
Browser("name:=Google.*").page("title:=Google.*").webedit("name:=q").set
"yourname"
else
Reporter.ReportEvent "Fail" , "unable to identify Google browser"
end if
Also look for description.create and set objects you will get good idea on
how to use
Happy Scripting... :)
Thanks
Srinivas Pavuluru
On Mon, Apr 27, 2009 at 12:26 PM, eve <[email protected]> wrote:
>
> Thank you for all the suggestions, but I am still having problems. I
> tried everything posted here, and I am also doing something like this:
>
> if("It is not possible to release the item \w*\.prt because it is
> locked\. It must first be unlocked\." = "It is not possible to release
> the item platform\.prt because it is locked\. It must first be unlocked
> \.") then
> print ("true")
> else print("false")
> end if
>
> Still returning false. What am I doing wrong?
>
> On Apr 26, 2:46 pm, Srinivas Pavuluru <[email protected]> wrote:
> > For Regular expression in QTP we can use ".*"
> >
> > "It is not possible to release the item .*.prt because it is
> > locked.* It must first be unlocked.*"
> >
> > Thanks
> > Srinivas P
> >
> > On Sat, Apr 25, 2009 at 7:47 AM, PBMax <[email protected]> wrote:
> >
> > > The easiest way is to do the following. It will allow any characters
> > > besides newline for the part name.
> >
> > > "It is not possible to release the item .+\.prt because it is
> > > locked\. It must first be unlocked\."
> >
> > > On Apr 24, 4:49 pm, eve <[email protected]> wrote:
> > > > I have a string:
> >
> > > > "It is not possible to release the item platform.prt because it is
> > > > locked. It must first be unlocked."
> >
> > > > I want to turn it into regular expression and remove platform.prt,
> > > > because it can be any other part name. How do I do that? In java I
> > > > can just do * instead of platform.prt and it will work. I see thats
> > > > now how VB works.
> >
> > > > Thank you in advance for help.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---