<?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; webdriver</title>
	<atom:link href="http://altentee.com/blogs/tag/webdriver/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>Watir-Webdriver-Performance gem released</title>
		<link>http://altentee.com/blogs/2011/watir-webdriver-performance-gem-released/</link>
		<comments>http://altentee.com/blogs/2011/watir-webdriver-performance-gem-released/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 04:09:59 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[watir]]></category>
		<category><![CDATA[webdriver]]></category>

		<guid isPermaLink="false">http://altentee.com/?p=1277</guid>
		<description><![CDATA[Today I added a simple watir-webdriver-performance gem whose purpose is to collect performance metrics specified for web applications to access timing information related to navigation and elements. User latency is an important quality benchmark for Web Applications. While JavaScript-based mechanisms can provide comprehensive instrumentation for user latency measurements within an application, in many cases, they [...]]]></description>
			<content:encoded><![CDATA[<p>Today I added a simple watir-webdriver-performance gem whose purpose is to collect performance metrics specified for web applications to access timing information related to navigation and elements.</p>
<blockquote><p>User latency is an important quality benchmark for Web Applications. While JavaScript-based mechanisms can provide comprehensive instrumentation for user latency measurements within an application, in many cases, they are unable to provide a complete end-to-end latency picture.</p>
<p>To address the need for complete information on user experience, this document introduces the <a href="http://w3c-test.org/webperf/specs/NavigationTiming/#nt-navigation-timing-interface">PerformanceTiming</a> interfaces. This interface allows JavaScript mechanisms to provide complete client-side latency measurements within applications. With the proposed interface, the previous example can be modified to measure a user&#8217;s perceived page load time.</p></blockquote>
<p><span id="more-1277"></span>You can read more about the PerformanceTiming <a href="http://w3c-test.org/webperf/specs/NavigationTiming/">specification here</a>. Essentially this gem collects all available metrics from the browser and summarises them in a format similar to the following diagram:</p>
<p style="text-align: center;"><img class="aligncenter" title="timing-overview" src="http://w3c-test.org/webperf/specs/NavigationTiming/timing-overview.png" alt="timing-overview" width="884" height="527" /></p>
<p>To use this gem simply install:</p>
<pre> gem install watir-webdriver-performance</pre>
<p>And use the browser.performance helper method to access the metrics.</p>
<pre>&gt;&gt; require 'watir-webdriver'
&gt;&gt; require 'watir-webdriver-performance'
&gt;&gt; b = Watir::Browser.new :chrome
&gt;&gt; b.goto "watirgrid.com"
=&gt; "https://github.com/90kts/watirgrid"
&gt;&gt; # End user response time was
?&gt; b.performance.summary[:response_time]/1000
=&gt; 8
&gt;&gt; #seconds ...
?&gt; # Time to first byte i.e. "server time" was
?&gt; b.performance.summary[:time_to_first_byte]
=&gt; 3341
&gt;&gt; #milliseconds ...
?&gt; # Summary timings available
{
    :summary => {
                   :redirect=>0,
                  :app_cache=>0,
                        :dns=>0,
            :tcp_connection=>982,
     :tcp_connection_secure=>721,
                  :request=>1222,
                    :response=>4,
           :dom_processing=>4293,
            :response_time=>7298,
       :time_to_first_byte=>2205,
        :time_to_last_byte=>2209
    },
    :navigation => {
                     :type => 0,
        :type_back_forward => 2,
           :redirect_count => 0,
            :type_reserved => 255,
            :type_navigate => 0,
              :type_reload => 1
    },
        :memory => {
        :total_js_heap_size => 0,
        :js_heap_size_limit => 0,
         :used_js_heap_size => 0
    },
        :timing => {
                   :domain_lookup_start => 1303180421599,
                        :load_event_end => 0,
                           :connect_end => 1303180421642,
                          :response_end => 1303180421853,
                           :dom_loading => 1303180421840,
                      :navigation_start => 0,
                          :redirect_end => 0,
                    :unload_event_start => 0,
               :secure_connection_start => 0,
                         :connect_start => 1303180421600,
          :dom_content_loaded_event_end => 1303180421934,
                     :domain_lookup_end => 1303180421600,
                       :dom_interactive => 1303180421934,
                      :load_event_start => 0,
                         :request_start => 1303180421642,
                        :response_start => 1303180421838,
                          :dom_complete => 0,
                           :fetch_start => 1303180421598,
        :dom_content_loaded_event_start => 1303180421934,
                        :redirect_start => 0,
                      :unload_event_end => 0
    }
  }</pre>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2011/watir-webdriver-performance-gem-released/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Watirgrid Support for Watir-Webdriver</title>
		<link>http://altentee.com/blogs/2010/watirgrid-support-for-watir-webdriver/</link>
		<comments>http://altentee.com/blogs/2010/watirgrid-support-for-watir-webdriver/#comments</comments>
		<pubDate>Sun, 10 Oct 2010 23:11:40 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[watir]]></category>
		<category><![CDATA[webdriver]]></category>

		<guid isPermaLink="false">http://altentee.com/?p=937</guid>
		<description><![CDATA[With the growing popularity of watir-webdriver I&#8217;ve decided to uplift watirgrid to support this newer approach. For installation instructions of Watir on top of WebDriver there is a good post on the topic by Željko Filipin. There&#8217;s also some musings on the &#8216;why&#8217; of watir-webdriver at Alister Scott&#8217;s blog, WatirMelon. If you want to get [...]]]></description>
			<content:encoded><![CDATA[<p>With the growing popularity of watir-webdriver I&#8217;ve decided to uplift watirgrid to support this newer approach. For installation instructions of Watir on top of WebDriver <a href="http://zeljkofilipin.com/2010/01/12/watir-on-webdriver/">there is a good post</a> on the topic by Željko Filipin. There&#8217;s also some musings on the &#8216;why&#8217; of watir-webdriver at Alister Scott&#8217;s blog, <a href="http://watirmelon.com/2010/04/10/watir-selenium-webdriver/">WatirMelon</a>.</p>
<p>If you want to get on with the <a href="http://altentee.com/2009/going-parallel-distributed-testing-across-a-grid-network-using-watir/">business of parallel testing across a grid network</a> with Watir or Watir-WebDriver then have a look at the following code:</p>
<p>Firstly, update your gem installation if it&#8217;s been a while <img src='http://altentee.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><code><sudo> gem update --system</code></p>
<p>Now install the prerelease version of Watirgrid</p>
<p><code><sudo> gem install watirgrid --prerelease</code></p>
<p>At this stage I haven&#8217;t updated my gemspec with dependencies, so you&#8217;ll also need uuid</p>
<p><code><sudo> gem install uuid</code></p>
<p>To test a simple 1 controller / 1 provider scenario using IE</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><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;">'watirgrid'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># setup a controller on port 12351 for your new grid</span>
controller = Controller.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>
        <span style="color:#ff3333; font-weight:bold;">:ring_server_port</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">12351</span>,
  <span style="color:#ff3333; font-weight:bold;">:loglevel</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#6666ff; font-weight:bold;">Logger::ERROR</span><span style="color:#006600; font-weight:bold;">&#41;</span>
controller.<span style="color:#9900CC;">start</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># add a provider to your grid</span>
<span style="color:#008000; font-style:italic;"># :browser_type =&gt; 'webdriver' if using webdriver or</span>
<span style="color:#008000; font-style:italic;"># :browser_type =&gt; 'ie' if using watir...</span>
provider = Provider.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>
        <span style="color:#ff3333; font-weight:bold;">:ring_server_port</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">12351</span>,
  <span style="color:#ff3333; font-weight:bold;">:loglevel</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#6666ff; font-weight:bold;">Logger::ERROR</span>, <span style="color:#ff3333; font-weight:bold;">:browser_type</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'webdriver'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
provider.<span style="color:#9900CC;">start</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># connect to the grid and take all providers from it (this time only one)</span>
grid = <span style="color:#6666ff; font-weight:bold;">Watir::Grid</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:ring_server_port</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">12351</span>,
    <span style="color:#ff3333; font-weight:bold;">:ring_server_host</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'127.0.0.1'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
grid.<span style="color:#9900CC;">start</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:take_all</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># for each provider on the grid, launch a new thread to start multiple browsers</span>
threads = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
grid.<span style="color:#9900CC;">browsers</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>browser<span style="color:#006600; font-weight:bold;">|</span>
        threads <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#CC00FF; font-weight:bold;">Thread</span>.<span style="color:#9900CC;">new</span> <span style="color:#9966CC; font-weight:bold;">do</span>
                <span style="color:#CC0066; font-weight:bold;">p</span> browser<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:hostname</span><span style="color:#006600; font-weight:bold;">&#93;</span>
                <span style="color:#CC0066; font-weight:bold;">p</span> browser<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:architecture</span><span style="color:#006600; font-weight:bold;">&#93;</span>
                <span style="color:#CC0066; font-weight:bold;">p</span> browser<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:browser_type</span><span style="color:#006600; font-weight:bold;">&#93;</span>
                <span style="color:#008000; font-style:italic;"># in this case we are starting a new IE browser</span>
                b = browser<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:object</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">new_browser</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:ie</span><span style="color:#006600; font-weight:bold;">&#41;</span>
                b.<span style="color:#9900CC;">goto</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;http://www.google.com&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
                b.<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;">'q'</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;watirgrid&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
                b.<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;btnI&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">click</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
threads.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>thread<span style="color:#006600; font-weight:bold;">|</span> thread.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#125;</span></pre></td></tr></table></div>

<p>There&#8217;s some <a href="http://github.com/90kts/watirgrid/blob/master/spec/webdriver_spec.rb">more examples of using watirgrid with watir-webdriver here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2010/watirgrid-support-for-watir-webdriver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Authenticating Proxy with Webdriver and Watir</title>
		<link>http://altentee.com/blogs/2010/authenticating-proxy-with-webdriver-and-watir/</link>
		<comments>http://altentee.com/blogs/2010/authenticating-proxy-with-webdriver-and-watir/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 00:31:43 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[watir]]></category>
		<category><![CDATA[webdriver]]></category>

		<guid isPermaLink="false">http://altentee.com/?p=927</guid>
		<description><![CDATA[A question came up on stack overflow about how to route Watir through an authenticating proxy within your script. The problem here is that you cannot auto authenticate to a proxy server using Chrome &#8211;proxy-server=my.proxy.com:3128 or using Firefox. Chrome will always prompt you for a user name and password on an authenticating proxy when it [...]]]></description>
			<content:encoded><![CDATA[<p>A question came up on stack overflow about how to <a href="http://stackoverflow.com/questions/2970777/how-do-i-route-watir-through-a-proxy-pragmatically">route Watir through an authenticating proxy within your script</a>.</p>
<p>The problem here is that you cannot auto authenticate to a proxy server using Chrome &#8211;proxy-server=my.proxy.com:3128 or using Firefox.</p>
<p>Chrome will always prompt you for a user name and password on an authenticating proxy when it starts up (via Webdriver or manually). Firefox will not prompt (when launched via WebDriver) and will silently fail.</p>
<p>I *almost* got this to work by modifying headers on the fly with a Firefox add on (<a href="https://addons.mozilla.org/en-US/firefox/addon/967/">Modify Headers</a>). Basic authentication is just base-64 encoded so you can force each request to authorize itself by modifying the Proxy-Authorization request header e.g.:<br />
<code>Proxy-Authorization	Basic asHJksaKHs87akhkjah7</code></p>
<p>However whilst this works for manually launched instances of Firefox, Webdriver launched instances would complain that the add on is not compatible with FF3.6.3 and so once again would fail. The other problem with this approach is that I couldn&#8217;t find a similar plugin for Chrome.</p>
<p>Eventually I gave in and went with a slightly more complicated workaround. That is, chaining an authenticated proxy (with squid) running on localhost with a cache_peer relationship to the authenticated proxy running out there  on the &#8216;tubes&#8217;. I had thought about using Webrick as a proxy (<a href="http://90kts.com/2008/httpwatch-a-free-alternative-using-ruby/">as per previous posts</a>) but lack of SSL support is a gotcha for me. Squid seemed most appropriate in this case:</p>
<p>To install squid from source:<br />
<code>cd /opt/src<br />
sudo curl -O http://www.squid-cache.org/Versions/v2/2.7/squid-2.7.STABLE9.tar.gz<br />
sudo tar xjf squid-2.7.STABLE9.tar.gz<br />
cd squid-2.7.STABLE9<br />
# I wanted SSL support for this<br />
./configure --enable-ssl<br />
make<br />
sudo make install</code></p>
<p>Edit the squid.conf (location is normally /etc/squid/squid.conf on linux):<br />
<code>sudo vim /usr/local/squid/etc/squid.conf</code></p>
<p><code># Don't want to run squid as root<br />
#  TAG: cache_effective_user<br />
cache_effective_user nobody<br />
#  TAG: cache_effective_group<br />
cache_effective_group wheel<br />
# Point this proxy to a peer cache, and provide the logon credentials<br />
#  TAG: cache_peer<br />
cache_peer proxy.altentee.com parent 3128 0 default no-query login=username:mypassword<br />
never_direct allow all<br />
# Allow access from my local private network<br />
#  TAG: cache_peer<br />
acl localnet src 10.0.0.0/0</code></p>
<p>Save changes and change ownership as appropriate:<br />
<code>sudo chown -R nobody:wheel /usr/local/squid</code></p>
<p>Initialize the cache and startup squid:<br />
<code>sudo /usr/local/squid/sbin/squid -z<br />
sudo /usr/local/squid/sbin/squid -D</code></p>
<p>Now you can configure firefox (using -ProfileManager) or chrome (using &#8211;proxy-server=127.0.0.1) to point to your local proxy server. This proxy will then authenticate on your behalf and peer all requests via the original parent.</p>
<p>A little long winded but achieves the outcome. Added side benefit is you&#8217;ve now got a local proxy (with access logs) that you can start doing interesting things with in your automation / performance tests like modifying headers and so forth.</p>
<p>Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2010/authenticating-proxy-with-webdriver-and-watir/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

