The following script will close multiple browsers that are currently open:
Method 1:
Set BrowserObject=Description.Create()
BrowserObject("micclass").value="Browser"
Set BrowserChildObjects=Desktop.ChildObjects(BrowserObject)
For i=0 to BrowserChildObjects.count-1
BrowserChildObjects(i).close
Next
Method 2: By closing the running process
SystemUtil.CloseProcessByName "iexplore.exe"
Method 3: If we want to exclude a particular browser, we have to make modification to the 1st script
Set BrowserObject=Description.Create()
BrowserObject("micclass").value="Browser"
Set PageObject=Description.Create()
PageObject("micclass").value="Page"
Set BrowserChildObjects=Desktop.ChildObjects(BrowserObject)
For i=0 to BrowserChildObjects.count-1
Set PageChildObjects=BrowserChildObjects(i).ChildObjects(PageObject)(0)
If Instr(PageChildObjects.GetROProperty("title"),"")=0 Then 'Provide the appropriate title of the page within the double quotes
BrowserChildObjects(i).close
End If
Next
No comments:
Post a Comment