Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sendkeys to close an open web browser
03-05-2010, 01:18 AM (This post was last modified: 03-05-2010 01:20 AM by prasadworld321.)
Post: #1
Sendkeys to close an open web browser

How to activate a web browser and sendkeys for closing it?
i have written the script as follw

Set WshShell = CreateObject("WScript.Shell")

Browser("name:=Google").Activate
wait(3)
WshShell.SendKeys ("%{F4}")


But it is not working.....
WORNING: no method like 'Activate' for web page

can anybody correct it??

Thanks
Find all posts by this user
Quote this message in a reply
03-05-2010, 02:21 AM
Post: #2
RE: Sendkeys to close an open web browser
(03-05-2010 01:18 AM)prasadworld321 Wrote:  How to activate a web browser and sendkeys for closing it?
i have written the script as follw

Set WshShell = CreateObject("WScript.Shell")

Browser("name:=Google").Activate
wait(3)
WshShell.SendKeys ("%{F4}")


But it is not working.....
WORNING: no method like 'Activate' for web page

can anybody correct it??

Thanks

This will close the last opened browser.

Function CloseLastOpenedBrowser()

Dim oDescription
Dim BrowserObjectList
Dim oLatestBrowserIndex

Set oDescription=Description.Create
oDescription("micclass").value="Browser"
Set BrowserObjectList=Desktop.ChildObjects(oDescription)
oLatestBrowserIndex=BrowserObjectList.count-1

Browser("creationtime:="&oLatestBrowserIndex).close

Set oDescription=Nothing
Set BrowserObjectList=Nothing
Print "Close Category Total Report browser pdf"
Reporter.ReportEvent 0, "Browser PDF" , "Report closed successfully"


End Function
Find all posts by this user
Quote this message in a reply
03-05-2010, 12:23 PM (This post was last modified: 03-05-2010 12:24 PM by prasadworld321.)
Post: #3
RE: Sendkeys to close an open web browser
Thanks.

it is working perfectly.
But i need to check the functionality of (Alt+F4)
Here i want to use the Key (Alt+F4) to close a web page in internet explorer 7.
Please guide me how to use the 'Sendkeys' method
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Function to create web objects (like Browser, Link, Page, etc) Arena 2 265 04-03-2012 08:21 AM
Last Post: Arena
  How to close a Window obj with a "text:="& ReportName mv8167 3 299 02-03-2012 10:08 PM
Last Post: rajpes
  SendKeys in Siebel8 mahadevan.swamy1 0 455 02-04-2011 12:22 AM
Last Post: mahadevan.swamy1
  Want to open a new browser window with new session umer830 1 850 01-18-2010 04:45 PM
Last Post: satan
  Unable to open a file using open file dialog windows vista umer830 10 1,830 12-21-2009 01:48 PM
Last Post: Saket

Forum Jump:


User(s) browsing this thread: 1 Guest(s)