automating browser menu options in QTP (1173 Views)
Reply
Occasional Contributor
amita
Posts: 6
Registered: ‎06-03-2009
Message 1 of 8 (1,173 Views)

automating browser menu options in QTP

Hi,
i need to select one of links in the Favourite menu of the iexplorer browser.
I am using web addin in QTP 9.2.
On recording the above steps nothing gets recorded in the script.
QTP is identifying the menu as wintool bar"ToolbarWindow32" .It is also identifying the dropdown of favorites as wintool bar"ToolbarWindow32".
can anyone please let me know who to automate it.
i could only procced till this code:
Browser("Browser").WinToolbar("ToolbarWindow32").ShowDropdown "F&avorites"
Please use plain text.
Frequent Advisor
SanRule
Posts: 63
Registered: ‎08-18-2009
Message 2 of 8 (1,173 Views)

Re: automating browser menu options in QTP

First of all this is not the right way of selecting a URL unless it is an application functionality and it is a rare scenario. Try opening a browser first and use the code

Browser().Navigate(Shortcut which u have)
Please use plain text.
Honored Contributor
shiv_p
Posts: 2,833
Registered: ‎04-23-2008
Message 3 of 8 (1,173 Views)

Re: automating browser menu options in QTP

Hi,

Since these are custom objects, you may not be able to record the operations

I did try recording on open IE tool bars....it worked for me....and reply as well..
my script looks like

Window("Microsoft Internet Explorer").WinToolbar("ToolbarWindow32").Press "F&avorites"
Window("Microsoft Internet Explorer").WinToolbar("ToolbarWindow32").Press "&Tools"
Window("Microsoft Internet Explorer").WinMenu("ContextMenu").Select "Internet Options..."
Dialog("Internet Options").WinButton("Cancel").Click

QTP identifies it as generic WinTool bar and you can perform Press operation
Please use plain text.
Honored Contributor
john scarpino
Posts: 1,344
Registered: ‎02-15-2008
Message 4 of 8 (1,173 Views)

Re: automating browser menu options in QTP

You may also want to try to test the Favorites path... C:\Documents and Settings\USER_GROUP_IF_NESC.\Favorites

Please use plain text.
Occasional Contributor
amita
Posts: 6
Registered: ‎06-03-2009
Message 5 of 8 (1,173 Views)

Re: automating browser menu options in QTP

Hi,
I tried using only WPF addin and recorded the steps to click on Favorites in the menubar and then to click a "Organize Favorites" in the Favorites.What i could only get in the code is:
Window("Microsoft Internet Explorer").WinToolbar("ToolbarWindow32").Press "F&avorites"
Window("Microsoft Internet Explorer").Window("Organize Favorites").Activate
This code on replaying doesnot work.

The context menu on Favorite tab click is identified as WinToolbar("ToolbarWindow32") and not a WinMenu("ContextMenu").
While for other tabs like "File","Edit","View","Tools","Help", the context menu is identified as WinMenu("ContextMenu").In these cases the Qtp code is working fine.

Please let me know how to automate selecting a link from the Favorite menu of the IE tool bar
Please use plain text.
Frequent Advisor
SanRule
Posts: 63
Registered: ‎08-18-2009
Message 6 of 8 (1,173 Views)

Re: automating browser menu options in QTP

Apologies again for asking this question. Why do you want to click a link from favorites? It becomes user dependant and every machine you have to add these favorites if another user is executing the tests. Unless your application says to take link from favorites, I dont think it is the right way.
Please use plain text.
Occasional Contributor
amita
Posts: 6
Registered: ‎06-03-2009
Message 7 of 8 (1,173 Views)

Re: automating browser menu options in QTP

Hi,
I am currently testing a browser application.
This browser has a button,which on being clicked,invokes another browser.
The testcase has a requirement to save this newly invoked browser by selecting the favorites menu->Add to favorites...
Later it has a step to check if the browser link has been saved in the favorites menu.
Please find the attched screen of the requirement.

Regards
amita
Please use plain text.
Frequent Advisor
SanRule
Posts: 63
Registered: ‎08-18-2009
Message 8 of 8 (1,173 Views)

Re: automating browser menu options in QTP

I am trying to give an alternate solution.
Try this code to add favorites

Const ADMINISTRATIVE_TOOLS = 6

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(ADMINISTRATIVE_TOOLS)
Set objFolderItem = objFolder.Self

Set objShell = WScript.CreateObject("WScript.Shell")
strDesktopFld = objFolderItem.Path
Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\AskSan.url")
objURLShortcut.TargetPath = "http://asksan.blogspot.com"
objURLShortcut.Save



Once it is done, use the following code to invoke the URL. remember the *******area should be replaced by proper path

Browser("Browser").Navigate "C:\Documents and Settings\*********username********\Favorites\AskSan.url"

Hope it helps
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation