<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: QTP Browser Methods: .Activate .Maximize .Minimize</title>
	<atom:link href="http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/feed/" rel="self" type="application/rss+xml" />
	<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/</link>
	<description>A Resource for Test Automation Development</description>
	<lastBuildDate>Fri, 18 May 2012 07:21:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Anshoo Arora</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-57531</link>
		<dc:creator>Anshoo Arora</dc:creator>
		<pubDate>Thu, 15 Mar 2012 11:54:22 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-57531</guid>
		<description>Vinay, there are several things you can do to work around this situation. I&#039;m going to break it down into a list:

1. Using Index, not sure how reliable it is though in your case
2. Something to consider is working with the developers to add an &#039;id&#039; property to it
3. You could also use visual relational identifiers if you&#039;re on QTP 11.0
4. If each button is in a WebTable, use WebTable methods (ChildItem etc.) to get to the correct object</description>
		<content:encoded><![CDATA[<p>Vinay, there are several things you can do to work around this situation. I&#8217;m going to break it down into a list:</p>
<p>1. Using Index, not sure how reliable it is though in your case<br />
2. Something to consider is working with the developers to add an &#8216;id&#8217; property to it<br />
3. You could also use visual relational identifiers if you&#8217;re on QTP 11.0<br />
4. If each button is in a WebTable, use WebTable methods (ChildItem etc.) to get to the correct object</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinay Sagar</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-55953</link>
		<dc:creator>Vinay Sagar</dc:creator>
		<pubDate>Fri, 17 Feb 2012 17:08:15 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-55953</guid>
		<description>hi Anshoo, 
your solutions are very much helpful to me !

i have a query... i met with a situation in which there are two buttons say B1 and B2 in a page and clicking on each button they display diffirent links (Something like a dropdown) and each link is identified as a webelement in QTP. Each link upon clicking will open a new window. All the links are dynamic in nature, their object name or innertext or outer text are always changing.Now my question is there are two links under B1 and B2 respectively with the same name as &quot;Style&quot;. The inner text or outer text of both of them are same again as &quot;Style&quot;. Now can you help me out in how to identify the link &quot;Style&quot; under B2  and click it using QTP in descriptive method ??</description>
		<content:encoded><![CDATA[<p>hi Anshoo,<br />
your solutions are very much helpful to me !</p>
<p>i have a query&#8230; i met with a situation in which there are two buttons say B1 and B2 in a page and clicking on each button they display diffirent links (Something like a dropdown) and each link is identified as a webelement in QTP. Each link upon clicking will open a new window. All the links are dynamic in nature, their object name or innertext or outer text are always changing.Now my question is there are two links under B1 and B2 respectively with the same name as &#8220;Style&#8221;. The inner text or outer text of both of them are same again as &#8220;Style&#8221;. Now can you help me out in how to identify the link &#8220;Style&#8221; under B2  and click it using QTP in descriptive method ??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maulik</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-37161</link>
		<dc:creator>Maulik</dc:creator>
		<pubDate>Sun, 25 Sep 2011 04:19:57 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-37161</guid>
		<description>thanks mate.
it worked for me :)</description>
		<content:encoded><![CDATA[<p>thanks mate.<br />
it worked for me :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anshoo Arora</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-37155</link>
		<dc:creator>Anshoo Arora</dc:creator>
		<pubDate>Sun, 25 Sep 2011 02:40:59 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-37155</guid>
		<description>Maulik, try this:

&lt;pre&gt;
Function fnWEB_objBrowserPage()
	On error resume next
		Set oBrowser = nothing

		Extern.Declare micHwnd, &quot;FindWindow&quot;, &quot;user32.dll&quot;, &quot;FindWindowA&quot;, micString, micString
		Hwnd = extern.FindWindow(&quot;IEFrame&quot;,vbNullString) &#039; returns value of hwnd

		Set oBrowser = Description.Create
		oBrowser (&quot;hwnd&quot;).value = Hwnd

		nativeHWND = Browser(&quot;hwnd:=&quot; &amp; Hwnd).Object.hWnd
		Window(&quot;HWND:=&quot;&amp; nativeHWND).Activate

		Set oBrowser1 = Browser(oBrowser)
		Set oBrowser = Browser(oBrowser).Page(&quot;micClass:=Page&quot;)

		&#039;msgbox oBrowser.getROProperty(&quot;title&quot;)
	On error GoTo 0
End Function
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Maulik, try this:</p>
<pre>
Function fnWEB_objBrowserPage()
	On error resume next
		Set oBrowser = nothing

		Extern.Declare micHwnd, "FindWindow", "user32.dll", "FindWindowA", micString, micString
		Hwnd = extern.FindWindow("IEFrame",vbNullString) ' returns value of hwnd

		Set oBrowser = Description.Create
		oBrowser ("hwnd").value = Hwnd

		nativeHWND = Browser("hwnd:=" &amp; Hwnd).Object.hWnd
		Window("HWND:="&amp; nativeHWND).Activate

		Set oBrowser1 = Browser(oBrowser)
		Set oBrowser = Browser(oBrowser).Page("micClass:=Page")

		'msgbox oBrowser.getROProperty("title")
	On error GoTo 0
End Function
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maulik</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-36938</link>
		<dc:creator>Maulik</dc:creator>
		<pubDate>Fri, 23 Sep 2011 08:10:34 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-36938</guid>
		<description>Hi anshoo,

I am trying to fetch hwnd value of a browser using following code.

Function fnWEB_objBrowserPage()
   On error resume next
   Set oBrowser = nothing
Extern.Declare micHwnd, &quot;FindWindow&quot;, &quot;user32.dll&quot;, &quot;FindWindowA&quot;, micString, micString
Hwnd = extern.FindWindow(&quot;IEFrame&quot;,vbNullString) &#039; returns value of hwnd
Set oBrowser = Description.Create
oBrowser (&quot;hwnd&quot;).value = Hwnd
&#039;Window(&quot;HWND:=&quot;&amp;Hwnd).Activate
Set oBrowser1 =  Browser(oBrowser)
Set oBrowser = Browser(oBrowser).Page(&quot;micClass:=Page&quot;)
&#039;msgbox oBrowser.getROProperty(&quot;title&quot;)
 On error GoTo 0
End Function
&#039;End of code 

extern.FindWindow(&quot;IEFrame&quot;,vbNullString) returns &#039;native&#039; value of an open browser
however when i use this property, QTP is not able to identify the browser using hwnd property since it checks for the identification hwnd property.
it is working fine with IE6 but not working for IE7 and above.
using object spy, i have observed  that the native HWND property value and identification HWND property value is different
Is there any solution for this ??

Regards,
Maulik</description>
		<content:encoded><![CDATA[<p>Hi anshoo,</p>
<p>I am trying to fetch hwnd value of a browser using following code.</p>
<p>Function fnWEB_objBrowserPage()<br />
   On error resume next<br />
   Set oBrowser = nothing<br />
Extern.Declare micHwnd, &#8220;FindWindow&#8221;, &#8220;user32.dll&#8221;, &#8220;FindWindowA&#8221;, micString, micString<br />
Hwnd = extern.FindWindow(&#8220;IEFrame&#8221;,vbNullString) &#8216; returns value of hwnd<br />
Set oBrowser = Description.Create<br />
oBrowser (&#8220;hwnd&#8221;).value = Hwnd<br />
&#8216;Window(&#8220;HWND:=&#8221;&amp;Hwnd).Activate<br />
Set oBrowser1 =  Browser(oBrowser)<br />
Set oBrowser = Browser(oBrowser).Page(&#8220;micClass:=Page&#8221;)<br />
&#8216;msgbox oBrowser.getROProperty(&#8220;title&#8221;)<br />
 On error GoTo 0<br />
End Function<br />
&#8216;End of code </p>
<p>extern.FindWindow(&#8220;IEFrame&#8221;,vbNullString) returns &#8216;native&#8217; value of an open browser<br />
however when i use this property, QTP is not able to identify the browser using hwnd property since it checks for the identification hwnd property.<br />
it is working fine with IE6 but not working for IE7 and above.<br />
using object spy, i have observed  that the native HWND property value and identification HWND property value is different<br />
Is there any solution for this ??</p>
<p>Regards,<br />
Maulik</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramesh</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-34588</link>
		<dc:creator>Ramesh</dc:creator>
		<pubDate>Thu, 01 Sep 2011 09:15:50 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-34588</guid>
		<description>Hi Anshoo,

I want to Connect IBM DB2 database. I used the following lines to connect. when i run the below code i get a Error message &quot;[[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Line (6): &quot;cnMidas.Open&quot;. &quot;
Set cn = CreateObject(&quot;ADODB.Connection&quot;)
connectionstr =&quot;Driver={IBM DB2 ODBC DRIVER};Database=myDatabase;Hostname=myserver Address;Port=1234;Protocol=TCPIP;Uid=myuserID;Pwd=mypassword;&quot;
cn.connectionstring = connectionstr
cn.Open 
If cn.state=1 then
	msgbox &quot;Pass&quot;
        Else
	msgbox &quot;Fail&quot;
End If

Can you please help me regarding this issue?</description>
		<content:encoded><![CDATA[<p>Hi Anshoo,</p>
<p>I want to Connect IBM DB2 database. I used the following lines to connect. when i run the below code i get a Error message &#8220;[[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified<br />
Line (6): &#8220;cnMidas.Open&#8221;. &#8221;<br />
Set cn = CreateObject(&#8220;ADODB.Connection&#8221;)<br />
connectionstr =&#8221;Driver={IBM DB2 ODBC DRIVER};Database=myDatabase;Hostname=myserver Address;Port=1234;Protocol=TCPIP;Uid=myuserID;Pwd=mypassword;&#8221;<br />
cn.connectionstring = connectionstr<br />
cn.Open<br />
If cn.state=1 then<br />
	msgbox &#8220;Pass&#8221;<br />
        Else<br />
	msgbox &#8220;Fail&#8221;<br />
End If</p>
<p>Can you please help me regarding this issue?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anshoo Arora</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-32737</link>
		<dc:creator>Anshoo Arora</dc:creator>
		<pubDate>Wed, 17 Aug 2011 01:47:54 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-32737</guid>
		<description>Imtiaz, not sure what went wrong there but please try this as an example:

&lt;pre&gt;
Function BrowserActivate(Object)
	Dim hWnd

	hWnd = Object.GetROProperty(&quot;hwnd&quot;)

	On Error Resume Next
		Window(&quot;hwnd:=&quot; &amp; hWnd).Activate

		If Err.Number &lt;&gt; 0 Then
			Window(&quot;hwnd:=&quot; &amp; Browser(&quot;hwnd:=&quot; &amp; hWnd).Object.hWnd).Activate
			Err.Clear
		End If
	On Error Goto 0
End Function
 
RegisterUserFunc &quot;Browser&quot;, &quot;Activate&quot;, &quot;BrowserActivate&quot;

Function BrowserMinimize(Object)
	Dim hWnd

	hWnd = Object.GetROProperty(&quot;hwnd&quot;)

	On Error Resume Next
		Window(&quot;hwnd:=&quot; &amp; hWnd).Activate

		If Err.Number &lt;&gt; 0 Then
			hWnd = Browser(&quot;hwnd:=&quot; &amp; hWnd).Object.hWnd
			Window(&quot;hwnd:=&quot; &amp; hWnd).Activate
			Err.Clear
		End If

		Window(&quot;hwnd:=&quot; &amp; hWnd).Minimize
	On Error Goto 0
End Function

RegisterUserFunc &quot;Browser&quot;, &quot;Minimize&quot;, &quot;BrowserMinimize&quot;

&#039;code
SystemUtil.Run &quot;iexplore.exe&quot;, &quot;http://google.com&quot;, , , 3

With Browser(&quot;title:=Google&quot;)
	If .Exist(15) Then
		.Activate
		.Minimize
	End If
End With
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Imtiaz, not sure what went wrong there but please try this as an example:</p>
<pre>
Function BrowserActivate(Object)
	Dim hWnd

	hWnd = Object.GetROProperty("hwnd")

	On Error Resume Next
		Window("hwnd:=" &#038; hWnd).Activate

		If Err.Number <> 0 Then
			Window("hwnd:=" &#038; Browser("hwnd:=" &#038; hWnd).Object.hWnd).Activate
			Err.Clear
		End If
	On Error Goto 0
End Function

RegisterUserFunc "Browser", "Activate", "BrowserActivate"

Function BrowserMinimize(Object)
	Dim hWnd

	hWnd = Object.GetROProperty("hwnd")

	On Error Resume Next
		Window("hwnd:=" &#038; hWnd).Activate

		If Err.Number <> 0 Then
			hWnd = Browser("hwnd:=" &#038; hWnd).Object.hWnd
			Window("hwnd:=" &#038; hWnd).Activate
			Err.Clear
		End If

		Window("hwnd:=" &#038; hWnd).Minimize
	On Error Goto 0
End Function

RegisterUserFunc "Browser", "Minimize", "BrowserMinimize"

'code
SystemUtil.Run "iexplore.exe", "http://google.com", , , 3

With Browser("title:=Google")
	If .Exist(15) Then
		.Activate
		.Minimize
	End If
End With
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imtiaz</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-32213</link>
		<dc:creator>Imtiaz</dc:creator>
		<pubDate>Fri, 12 Aug 2011 06:28:33 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-32213</guid>
		<description>System and Tools details

OS = Window XP  , QTP Version 10.0 , IE7


Hi Anshoo,

I am not able to execute successfully

I am using this code , 


Function BrowserActivate(Object)
	Dim hWnd


	hWnd = Browser(&quot;hwnd:=&quot; &amp; hWnd).Object.hWnd
 
	On Error Resume Next
		Window(&quot;hwnd:=&quot; &amp; hWnd).Activate
 
		If Err.Number  0 Then
			Window(&quot;hwnd:=&quot; &amp; Browser(&quot;hwnd:=&quot; &amp; hWnd).Object.hWnd).Activate
			Err.Clear
		End If
	On Error Goto 0
End Function
 
RegisterUserFunc &quot;Browser&quot;, &quot;Activate&quot;, &quot;BrowserActivate&quot;

Function BrowserMinimize(Object)
	Dim hWnd
 


hWnd = Browser(&quot;hwnd:=&quot; &amp; hWnd).Object.hWnd


 
	On Error Resume Next
		Window(&quot;hwnd:=&quot; &amp; hWnd).Activate
 
		If Err.Number  0 Then
			hWnd = Browser(&quot;hwnd:=&quot; &amp; hWnd).Object.hWnd
			Window(&quot;hwnd:=&quot; &amp; hWnd).Activate
			Err.Clear
		End If
 
		Window(&quot;hwnd:=&quot; &amp; hWnd).Minimize
	On Error Goto 0
End Function
 
RegisterUserFunc &quot;Browser&quot;, &quot;Minimize&quot;, &quot;BrowserMinimize&quot;

Set obj = Description.create()

obj(&quot;micclass&quot;).value = &quot;Browser&quot;

obj(&quot;name&quot;).value = &quot;QTP Browser Methods.*&quot;  &#039; : .Activate .Maximize .Minimize — Relevant Codes (by Anshoo Arora)&quot;

obj(&quot;title&quot;).value  = &quot;QTP Browser Methods.*&quot;  &#039;: .Activate .Maximize .Minimize — Relevant Codes (by Anshoo Arora) - Windows Internet Explorer&quot;





Call BrowserMinimize(obj)



I am getting this error 

&quot;Cannot identify the object &quot;[ Browser ]&quot; (of class Browser). Verify that this object&#039;s properties match an object currently displayed in your application.

Line (26): &quot;hWnd = Browser(&quot;hwnd:=&quot; &amp; hWnd).Object.hWnd&quot;. &quot;</description>
		<content:encoded><![CDATA[<p>System and Tools details</p>
<p>OS = Window XP  , QTP Version 10.0 , IE7</p>
<p>Hi Anshoo,</p>
<p>I am not able to execute successfully</p>
<p>I am using this code , </p>
<p>Function BrowserActivate(Object)<br />
	Dim hWnd</p>
<p>	hWnd = Browser(&#8220;hwnd:=&#8221; &amp; hWnd).Object.hWnd</p>
<p>	On Error Resume Next<br />
		Window(&#8220;hwnd:=&#8221; &amp; hWnd).Activate</p>
<p>		If Err.Number  0 Then<br />
			Window(&#8220;hwnd:=&#8221; &amp; Browser(&#8220;hwnd:=&#8221; &amp; hWnd).Object.hWnd).Activate<br />
			Err.Clear<br />
		End If<br />
	On Error Goto 0<br />
End Function</p>
<p>RegisterUserFunc &#8220;Browser&#8221;, &#8220;Activate&#8221;, &#8220;BrowserActivate&#8221;</p>
<p>Function BrowserMinimize(Object)<br />
	Dim hWnd</p>
<p>hWnd = Browser(&#8220;hwnd:=&#8221; &amp; hWnd).Object.hWnd</p>
<p>	On Error Resume Next<br />
		Window(&#8220;hwnd:=&#8221; &amp; hWnd).Activate</p>
<p>		If Err.Number  0 Then<br />
			hWnd = Browser(&#8220;hwnd:=&#8221; &amp; hWnd).Object.hWnd<br />
			Window(&#8220;hwnd:=&#8221; &amp; hWnd).Activate<br />
			Err.Clear<br />
		End If</p>
<p>		Window(&#8220;hwnd:=&#8221; &amp; hWnd).Minimize<br />
	On Error Goto 0<br />
End Function</p>
<p>RegisterUserFunc &#8220;Browser&#8221;, &#8220;Minimize&#8221;, &#8220;BrowserMinimize&#8221;</p>
<p>Set obj = Description.create()</p>
<p>obj(&#8220;micclass&#8221;).value = &#8220;Browser&#8221;</p>
<p>obj(&#8220;name&#8221;).value = &#8220;QTP Browser Methods.*&#8221;  &#8216; : .Activate .Maximize .Minimize — Relevant Codes (by Anshoo Arora)&#8221;</p>
<p>obj(&#8220;title&#8221;).value  = &#8220;QTP Browser Methods.*&#8221;  &#8216;: .Activate .Maximize .Minimize — Relevant Codes (by Anshoo Arora) &#8211; Windows Internet Explorer&#8221;</p>
<p>Call BrowserMinimize(obj)</p>
<p>I am getting this error </p>
<p>&#8220;Cannot identify the object &#8220;[ Browser ]&#8221; (of class Browser). Verify that this object&#8217;s properties match an object currently displayed in your application.</p>
<p>Line (26): &#8220;hWnd = Browser(&#8220;hwnd:=&#8221; &amp; hWnd).Object.hWnd&#8221;. &#8220;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-30911</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 03 Aug 2011 14:11:13 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-30911</guid>
		<description>Hi Anshoo,

Im Automating putty using QTP. here i need to run some jobs using Unix commands for 2 different environment and compare the 2 resulting records. is this possible with QTP??</description>
		<content:encoded><![CDATA[<p>Hi Anshoo,</p>
<p>Im Automating putty using QTP. here i need to run some jobs using Unix commands for 2 different environment and compare the 2 resulting records. is this possible with QTP??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramesh</title>
		<link>http://relevantcodes.com/qtp-browser-methods-activate-maximize-minimize/#comment-30536</link>
		<dc:creator>Ramesh</dc:creator>
		<pubDate>Mon, 01 Aug 2011 13:07:33 +0000</pubDate>
		<guid isPermaLink="false">http://relevantcodes.com/?p=2808#comment-30536</guid>
		<description>Can any one please tell me what addins are required for Autosys tool. i used Java Addin but only the window and java table is getting identified. please help me</description>
		<content:encoded><![CDATA[<p>Can any one please tell me what addins are required for Autosys tool. i used Java Addin but only the window and java table is getting identified. please help me</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 10/14 queries in 0.003 seconds using disk: basic
Object Caching 379/379 objects using disk: basic
Content Delivery Network via N/A

Served from: relevantcodes.com @ 2012-05-19 11:19:44 -->
