Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Friday, 4 December 2015

Methods for Browser Object

Following are methods for Browser object:

OpenNewTab:-Opens a new tab in the existing opened browser window. 
Ex:Browser("CreationTime:=0").OpenNewTab()


Activate Browser:  using this method we can activate browser.
ExBrowser("title:=Google.*").Activate

Minimize Browser: using this we can minimize browser.
EX: Window("name:=Seessionwindow").Minimize

Maximize Browser: using this method we can maximize browser.
Ex: Window("name:=sessionwindow").Maximize

Navigate:-Redirects to given URL.

EX: Browser("CreationTime:=1").Navigate "www.Google.com"

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

Ex: Browser("CreationTime:=0").FullScreen

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

Ex:Browser("CreationTime:=0").Refresh

DeleteCookies:-For deleting the cookies from the browser.

Ex: Browser("CreationTime:=0").DeleteCookies

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

Ex: Browser("CreationTime:=0").CloseAllTabs()

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

Ex:Browser("CreationTime:=0").Sync

NOTE: Browser does not support the ActivateMinimizeMaximize methods

Example:


'Open a new Browser using Util Object
SystemUtil.Run "iexplore.exe", "www.uft.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()