Good morning,

I have created a very nice script that does a few specialized things in the way 
of testing our website using Watir.  First of all it is not your typical test, 
as it is a Spider or Web Crawler specialized to crawl our website.  It only 
touches links that contain our domain, that aren't associated with basic menu 
navigation (because the same menus are on every page) and those that don't 
belong to individual forms, such as submit buttons that are actually images 
that send data to ASPX web applications.  Those are just some technical 
details, though they aren't really important.  The Spider does no clicking, 
rather it goes to a page that was previously defined and gathers all of the 
links on that page to use later.  The following explains briefly the recursive 
method used:

1. Go to home page
2. Gather all of the links on that page
3. Remove links that are associated with menus, images, forms, or that go 
outside of our website from the array
4. Go to each page in the array (using IE.goto)
5. Return to step two for each page

This is a recursive method, so it only ever makes one array of all of the links 
in the long run.  It's really quite amazing, simple, and intuitive.  Besides 
the rules that are defined specifically for our website (step 3), one could use 
this same algorithm on pretty much any website to crawl it.  Also one must 
define how many levels of links deep to recurse, otherwise it would potentially 
run forever, given perfect conditions.  Now on to my problem.

When I run my recursive script, I expect it to traverse every link within our 
rules to four levels by default.  As the Spider goes through our website it 
collects a great number of links - level 1 = 1, level 2 = 27, level 3 = 475, 
level 4 = 2670.  It does a great job of getting through everything until 
suddenly it gets to the 129th out of 2670 on level 4, then it throws the 
following exception and gives the following baffling information (baffling 
because it doesn't seem like it should do this, read through the stack trace 
and my comments afterward before you draw any conclusions please - this is 
completely consistent - happens in the same place every time, so I haven't 
ruled out a website issue, but please continue):

c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1347:in `method_missing': unknown proper
ty or method `document' (WIN32OLERuntimeError)
    HRESULT error code:0x800706ba
      The RPC server is unavailable.    from c:/ruby/lib/ruby/site_ruby/1.8/wati
r.rb:1347:in `document'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3648:in `length'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2088:in `initialize'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:620:in `new'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:620:in `images'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:91:in `blnCheckAllImages'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:234:in `recurseLinks'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:219:in `each'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:219:in `recurseLinks'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:286:in `recurseLinks'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:362
        from c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:356

As you can see it appears as though the RPC server stopped, or became futily 
busy (I know futily isn't a word, but I think you can get my drift if you've 
ever seen a Borg episode of Star Trek).  For my problems I found the following 
article in the forums (linked here 
http://www.mail-archive.com/[email protected]/msg05305.html):

"...This can happen in the following scenario

1. create browser
2. close browser
3. create browser
-- error sometimes happens here

The problem lies in the way IE is structured and the way that Watir 1.4 
interacts with it. Specifically, Watir creates a "client windows" that 
interacts with the "IE RPC Server". This is not a web server, but rather the IE 
process running on your computer. When the last client to this server is 
closed, the "server" will also start closing, but this happens 
asynchronously. [b]In your case, you are probably trying to get a new IE 
window, and it is trying to connect to the IE RPC server that is actually in 
the process of closing down.

The simplest workaround is to reuse IE windows instead of opening and closing 
them.[/b] Another workaround is to leave IE window open at the beginning of 
your session (it can be invisible) and then when you open and close windows, 
the IE RPC Server will never shutdown, because there always will be one window 
connected to it..."

Notice the part I highlighted in bold, that would be the logical 
problem/solution scenario, wouldn't it, but I ALWAYS reuse the same window, and 
never try to attach to another window or open a new window.  I also have taken 
a screenshot of every page I've browsed to (378 pages so far).

I am using Watir 1.4 (latest) and Ruby 1.8.5-21 I believe on Windows (of 
course) with Internet Explorer 6.  PLEASE, please help me if you have a 
solution.  I have thought to maybe put a begin...rescue...end block around some 
of my code to try and keep this from happening, but I'm not sure that would do 
any good.  Oh also, I know pretty much that something WIERD is going on because 
my browser window is always closed at this point - when the error occurs, which 
is obviously the reason for the RPC Server problem.  But WHY is it closing?  I 
do not believe that you seeing my code would help any.  One other hint I can 
give as to what I see is the following, which is a larger bit of my log near 
the end, showing what happened on the two pages before the script choked - also 
I love Watir, it's awesome! (Some notes, the '-----' signify when a new page is 
loaded and when one has been completely taken care of, i.e. links gathered, 
etc., and the '.....|' symbolize checking images to see i
 f any are broken - I do that by checking whether the file size of the image is 
-1 or greater than 0, because if it's -1, then it's broken):

I, [2006-11-08T18:01:08.425000 #5768]  INFO -- : * Benchmark - http://www.stagin
g.vehix.com/finance/calculators/LowInterestFinancing.aspx?radius=75&year=&condit
ion=1: Seconds to browse to http://www.staging.vehix.com/finance/calculators/Low
InterestFinancing.aspx?radius=75&year=&condition=1: (3.133000) seconds
I, [2006-11-08T18:01:08.425000 #5768]  INFO -- : * Current URL: http://www.stagi
ng.vehix.com/finance/calculators/LowInterestFinancing.aspx?radius=75&year=&condi
tion=1
I, [2006-11-08T18:01:08.425000 #5768]  INFO -- : * Total number of images on thi
s page = 37
....................................|
I, [2006-11-08T18:01:08.986000 #5768]  INFO -- : * Last erroneous image (-1 if n
one): -1
I, [2006-11-08T18:01:09.298000 #5768]  INFO -- : * Stored screenshot: Browsed to
 Vehix.com - Calculators _ Low Interest Financing_1163034068 level 4
I, [2006-11-08T18:01:09.469000 #5768]  INFO -- : * Added 11 links to strHrefArra
y.
I, [2006-11-08T18:01:09.469000 #5768]  INFO -- : * Stored links for page 128/267
0 into objSubTempArray - gathered from level 3
-------------------------
I, [2006-11-08T18:01:12.010000 #5768]  INFO -- : * Benchmark - http://www.stagin
g.vehix.com/finance/calculators/RebateVsLowInterest.aspx?radius=75&year=&conditi
on=1: Seconds to browse to http://www.staging.vehix.com/finance/calculators/Reba
teVsLowInterest.aspx?radius=75&year=&condition=1: (2.541000) seconds
I, [2006-11-08T18:01:12.010000 #5768]  INFO -- : * Current URL: http://www.stagi
ng.vehix.com/finance/calculators/RebateVsLowInterest.aspx?radius=75&year=&condit
ion=1
I, [2006-11-08T18:01:12.010000 #5768]  INFO -- : * Total number of images on thi
s page = 37
....................................|
I, [2006-11-08T18:01:12.337000 #5768]  INFO -- : * Last erroneous image (-1 if n
one): -1
I, [2006-11-08T18:01:12.617000 #5768]  INFO -- : * Stored screenshot: Browsed to
 Vehix.com - Calculators _ Rebate vs. Low Interest_1163034072 level 4
I, [2006-11-08T18:01:12.805000 #5768]  INFO -- : * Added 11 links to strHrefArra
y.
I, [2006-11-08T18:01:12.805000 #5768]  INFO -- : * Stored links for page 129/267
0 into objSubTempArray - gathered from level 3
-------------------------
W, [08-Nov-2006 18:01:18#5768]  WARN -- : runtime error in wait
I, [2006-11-08T18:01:18.353000 #5768]  INFO -- : * Benchmark - http://www.stagin
g.vehix.com/finance/creditReport.aspx?radius=75&year=&condition=1: Seconds to br
owse to http://www.staging.vehix.com/finance/creditReport.aspx?radius=75&year=&c
ondition=1: (5.548000) seconds
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1347:in `method_missing': unknown proper
ty or method `document' (WIN32OLERuntimeError)
    HRESULT error code:0x800706ba
      The RPC server is unavailable.    from c:/ruby/lib/ruby/site_ruby/1.8/wati
r.rb:1347:in `document'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3648:in `length'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2088:in `initialize'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:620:in `new'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:620:in `images'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:91:in `blnCheckAllImages'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:234:in `recurseLinks'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:219:in `each'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:219:in `recurseLinks'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:286:in `recurseLinks'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:362
        from c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
        from C:/Documents and Settings/nathanl/My Documents/Watir Tests/Spider/S
pider.rb:356

Thank you very much in advance.

Nathan Lane
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5183&messageID=14370#14370
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to