<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Altentee » Performance &#38; Test Automation Experts &#187; .click_no_wait</title>
	<atom:link href="http://altentee.com/blogs/tag/click_no_wait/feed/" rel="self" type="application/rss+xml" />
	<link>http://altentee.com</link>
	<description>Performance and Test Automation Experts</description>
	<lastBuildDate>Fri, 04 Nov 2011 03:17:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Q. How do I deal with javascript popup&#039;s?</title>
		<link>http://altentee.com/blogs/2008/q-how-do-i-deal-with-javascript-popups/</link>
		<comments>http://altentee.com/blogs/2008/q-how-do-i-deal-with-javascript-popups/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 10:34:41 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[.click_no_wait]]></category>
		<category><![CDATA[autoit]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[popup]]></category>

		<guid isPermaLink="false">http://justaddwatir.com/watir/?p=42</guid>
		<description><![CDATA[A. Invoke the autoit function library with the .click_no_wait method&#8230; You will need to install autoit. You can download it here, once installed you can call the function library using the win32OLE extension library. Example html: &#60;html&#62; &#60;head&#62; &#60;script language=&#34;javascript&#34;&#62; function msgbox (textstring) { alert (textstring) } &#60;/script&#62; &#60;/head&#62; &#60;body id=&#34;test_00test_0107&#34; onload=&#34;&#34;&#62; &#60;form&#62; &#60;input name=&#34;text1&#34; [...]]]></description>
			<content:encoded><![CDATA[<p><strong>A. Invoke the autoit function library with the .click_no_wait method&#8230;</strong><br />
You will need to install autoit. You can download it <a href=http://www.autoitscript.com/autoit3/>here</a>, once installed you can call the function library using the win32OLE extension library.<br />
<a href="http://justaddwatir.com/watir/test_html/tc_0001_0100/test_0107.html">Example html</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">language</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript&quot;</span>&gt;</span>
      function msgbox (textstring) {
      alert (textstring) }
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;test_00test_0107&quot;</span> <span style="color: #000066;">onload</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
         <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text1&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span>text&gt;</span>
         <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span>button <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;show me&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;msgbox(form.text1.value)&quot;</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>Example watir:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'watir'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'win32ole'</span>
&nbsp;
autoit = WIN32OLE.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'AutoItX3.Control'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">goto</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'http://justaddwatir.com/watir/test_html/tc_0101_0200/test_0107.html'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">text_field</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span>,<span style="color:#996600;">&quot;text1&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">set</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Justaddwatir&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">button</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span>,<span style="color:#996600;">&quot;submit&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">click_no_wait</span>
autoit.<span style="color:#9900CC;">WinWaitActive</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;[Class:#32770]&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
result =autoit.<span style="color:#9900CC;">ControlClick</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;[Class:#32770]&quot;</span>,<span style="color:#996600;">&quot;&quot;</span>,<span style="color:#996600;">&quot;Button1&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;successful click =1 unsuccessful =0, the result was &quot;</span><span style="color:#006600; font-weight:bold;">+</span> result</pre></div></div>

<p>In order for the autoit function to execute, you need to use the .click_no_wait method in watir before the autoit function. This is because once the pop up is presented, the focus comes off the IE window and the script will pause. The .click_no_wait tells the script to continue running regardless of what happens next.<br />
You may use the autoit window identifier to get the properties of the pop up and the button attributes.</p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2008/q-how-do-i-deal-with-javascript-popups/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

