Understanding Browser methods,by opening multifarious Tabs of Browser in UFT – User friendly Tech help

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

n

nSolution:- 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”
n
n
nFor this we will learn and use the following methods of Browser object :- 
n
n
nOpenNewTab:-Opens a new tab in the existing opened browser window. 
n
nNavigate:- Redirects to given URL.
n
nFullScreen:-Open the browser in Full-screen mode(F11).
n
nRefresh:-Refreshs the opened page(Like F5).
n
nDeleteCookies:-For deleting the cookies from the browser.
n
nCloseAllTabs:-Close all the opened tab and also the browser instance.
n
nSync:-Wait for the browser for navigating to the opened URL Application.
n
nCode

n

'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()

n

nWorking with Browser commands in Selenium

Was this article helpful?
YesNo

Similar Posts