I have 2 browsers open having the same title and I want to close the second browser?
I have 2 browsers open presently having the same title and I want to close the second or first browser using QTP Tool?
Thanks in advance.
Re: I have 2 browsers open having the same title and I want to close the second brows
Why don't you select the option of"close the browser when test close".
Or record the same action in QTP recording, QTP will do it for you.
Re: I have 2 browsers open having the same title and I want to close the second brows
if Browser("index:=0").Exist([COLOR="Red"]2[/COLOR]) then
a = Browser("index:=0").close 'It will close 2nd browser
end if
Re: I have 2 browsers open having the same title and I want to close the second brows
Rajaputra,
I would like to kno how does this work... ?
Re: I have 2 browsers open having the same title and I want to close the second brows
simple
[COLOR="Red"]browser("index:=0").exist[/COLOR] means to confirm that whether the particular browser is already opened or not. So that we can close.
Here index = [LIST][*]0 means recently opened browser[*]1 means recent but one and so on[/LIST]
Re: I have 2 browsers open having the same title and I want to close the second brows
nice Solution,
This is the only way to distinguish between two browsers which has the same name still sometime its really dificult to distinguish and it closes the wrong wondow :mad: .
M still working on this to get a robust solution if anybody has ne suggestion then they can help me out.
Re: I have 2 browsers open having the same title and I want to close the second brows
Hai friend,
Just use this script
If Browser("CreationTime:=1").Exist then
Browser.close
End If
Thanks
Deepa
Re: I have 2 browsers open having the same title and I want to close the second brows
Try this:
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = true
IE.Navigate strAppUrl
While IE.Busy
Wend
It worked for me