Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sendkeys to close an open web browser
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
How to activate a web browser and sendkeys for closing it?
i have written the script as follw

Code:
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
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
This will close the last opened browser.

Code:
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
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to close/restart UFT in "Not responding" status with AOM script CharlieMadrid 0 1,229 05-21-2020, 08:46 PM
Last Post: CharlieMadrid
  DP Web Browser/Page issues rstimers 1 2,435 08-14-2015, 12:37 PM
Last Post: venkatesh9032
  Cannot find the "[ WebEdit ]" object's parent "[ Browser ]" (class Browser). Verify t Divya Roopa 1 8,460 03-11-2014, 12:13 PM
Last Post: devarapallliramana
  Getting the complete width and height of the web browser using qtp learnQtptips 1 4,380 05-27-2013, 01:17 PM
Last Post: ravi.gajul
  Function to create web objects (like Browser, Link, Page, etc) Arena 2 3,816 04-03-2012, 08:21 AM
Last Post: Arena

Forum Jump:


Users browsing this thread: 1 Guest(s)