#
# Watir fails to get url for a file on the local file system, but not
for same file on server
# even though both files are the same, only difference is one is
hosted is on server
# while the other is on local file system. Both files load OK into the
browser.

require 'rubygems'
require 'watir'

sServerURL = "http://myserver.com/html/bug.html";
sLocalURL = "file://C:/bug.html"

browser = Watir::Browser.new

browser.goto(sServerURL)
sCurrentServerURL = browser.url  # <--- THIS WORKS
puts("Current URL: " + sCurrentServerURL.to_s)
sleep 2  # Wait long enough to see that the browser loaded the page

browser.goto(sLocalURL)
sCurrentLocalURL = browser.url  # <--- THIS FAILS. Why?
puts("Current URL: " + sCurrentLocalURL.to_s)
sleep 2 # Wait long enough to see that the browser loaded the page
browser.close

######  Here's the contents of the file:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Watir URL Bug</title>
</head>
<body>
Why is this bug occuring?
</body>
</html>



#####  Here's the error:

>ruby bug.rb
Current URL: http://home.comcast.net/~watirworks/html/bug.html
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie-class.rb:
465:in `method_missing': unknown property or method
`LocationURL' (WIN32OLERuntimeError)
    HRESULT error code:0x80010108
      The object invoked has disconnected from its clients.     from c:/
ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie-class.rb:465:in
`url'
        from bug.rb:33
>Exit code: 1

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: [email protected]
To unsubscribe: [email protected]

Reply via email to