Just an update to my previous post. Because the website am testing
requires some form of LDAP authentication, the RESPONSE_CODE_CHECKER
code checker i have written fails with a 401 everytime, any ideas as
to how to fix this???

On Mar 3, 10:45 am, yoggy <[email protected]> wrote:
> Hi Marek,
>
> I did what you told me to do and it justs prints a space and nothing
> else. I am not sure the checker which ships with Watir is robust
> enough to check the page response. I think it doesnt raise any
> exception for page which i am testing. The watir page checker code is
> below:
>
>  def check_for_http_error
>       # check for IE7
>       n = self.document.invoke('parentWindow').navigator.appVersion
>       m=/MSIE\s(.*?);/.match( n )
>       if m and m[1] =='7.0'
>         if m = /HTTP (\d\d\d.*)/.match( self.title )
>           raise NavigationException, m[1]
>         end
>       else
>         # assume its IE6
>         url = self.document.location.href
>         if /shdoclc.dll/.match(url)
>           m = /id=IEText.*?>(.*?)</i.match(self.html)
>           raise NavigationException, m[1] if m
>         end
>       end
>       false
>
> I dont know ruby too well but it seems to be doing some checks on url
> and body text of page displayed which i dont think would work
> extremely well for all web apps
>
> The error on page looks like:
>
> Server Error in '/' Application.
> Access is denied.
> Description: An error occurred while accessing the resources required
> to serve this request. The server may not be configured for access to
> the requested URL.
>
> Error message 401.2.: Unauthorized: Logon failed due to server
> configuration.  Verify that you have permission to view this directory
> or page based on the credentials you supplied and the authentication
> methods enabled on the Web server.  Contact the Web server's
> administrator for additional assistance.
>
> so i wrote a custom error checker which uses the
> Net::Http.get_response for ruby and that seems to work okay. The code
> looks like that.
>
> RESPONSE_CODE_CHECKER = lambda do |browser|
>   response = Net::HTTP.get_response(URI.parse(browser.url.to_s))
>   raise Watir::Exception::NavigationException unless(response.code =~ /
> 2|3\d{2}/ )
> end
>
> I would appreciate some comments or feeback on this as i am not a ruby
> guru ......
>
> On Mar 3, 2:39 am, marekj <[email protected]> wrote:
>
> > When you run those lines what happens?
>
> > begin
> >   browser.add_checker PageCheckers::NAVIGATION_CHECKER
> >   browser.goto("http://www.somecrazynonexistantthing.com/reallynonexistant";)
> > resuce=> e
> >   put e
> > end
>
> > what is the value of e?
>
> > marekj
>
> > Watirloo: Semantic Page Objects in 
> > UseCaseshttp://github.com/marekj/watirloo/
> > Support Watir Projecthttp://pledgie.com/campaigns/2982
>
> > On Tue, Mar 2, 2010 at 10:16 AM, yoggy <[email protected]> wrote:
> > > I have included the raise and it doesnt work still.
>
> > > I also removed the rescue and puts line
>
> > > still this doesnt work,
>
> > > My test stak is using Cucumber + Watir, could this be a reason ...
> > > Confused :(
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Watir General" group.
> > > To post to this group, send email to [email protected]
> > > Before posting, please read the following 
> > > guidelines:http://wiki.openqa.org/display/WTR/Support
> > > To unsubscribe from this group, send email to 
> > > [email protected]
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/watir-general
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general

Reply via email to