Understanding Browser methods,by opening multifarious Tabs of Browser in UFT

To understand the various common methods of Browser Object in UFT ,we will open 2 tabs in the same browser instance.
Scenario:- How we can open webpage in different Tabs of the same Browser.

Working with Browser


Solution:- We need to launch browser and open a webpage(say “www.uftHelp.com”), within the same instance we’ll open another tab and re-direct to a different webpage say “www.Google.com”


For this we will learn and use the following methods of Browser object :- 

Browser object methods UFT
OpenNewTab:-Opens a new tab in the existing opened browser window. 


Navigate:- Redirects to given URL.


FullScreen:-Open the browser in Full-screen mode(F11).


Refresh:-Refreshs the opened page(Like F5).


DeleteCookies:-For deleting the cookies from the browser.


CloseAllTabs:-Close all the opened tab and also the browser instance.


Sync:-Wait for the browser for navigating to the opened URL Application.


Code

'Open a new Browser using Util Object
SystemUtil.Run "iexplore.exe", "www.uftHelp.com"
'Browser Sync
Browser("CreationTime:=0").Sync
'Delete cookies from the Browser
Browser("CreationTime:=0").DeleteCookies
'Refreshes the Opened Page
Browser("CreationTime:=0").Refresh
'Opening a new tab within the same browser
Browser("CreationTime:=0").OpenNewTab()
'Opening Browser in FullScreen mode
Browser("CreationTime:=0").FullScreen
'Sync for new tab
Browser("CreationTime:=1").Sync
'Navigate to perticular URL in the new tab
Browser("CreationTime:=1").Navigate "www.Google.com"
'Find total number of tabs in the browser window
iTabs = Browser("CreationTime:=0").GetROProperty("number of tabs")
msgbox iTabs 'Displays the value 2
'Close all the tabs in the browser window
Browser("CreationTime:=0").CloseAllTabs()


Working with Browser commands in Selenium