axel
November 7, 2006, 11:03am
1
Hello,
when trying to access a certain HTML-frame, I get:
“in `request’: Unhandled response (WWW::Mechanize::ResponseCodeError)”
and the page returns: “400 Bad Request”
With browser, it works.
Thank you for any help!
Axel
axel ° friedrich ° _smail AT gmx ° de
Details
°°°°°°°
ruby 1.8.4 (2005-12-24) [i386-mswin32]
Windows 98SE
Code
°°°°
require ‘rubygems’
require ‘mechanize’
agent = WWW::Mechanize.new
page =
agent.get(“https://www.frankfurter-fondsbank.de/login/Logon.jsp ”)
… login stuff…
begin
framePage = agent.click( page2.frames.text(‘nav’) ) # This works
not
framePage = agent.click( page2.frames.text(‘head’) ) # This works
rescue WWW::Mechanize::ResponseCodeError => ex
puts ex.page.body
end
page2 looks like this
°°°°°°°°°°°°°°°°°°°°°
...
axel
November 7, 2006, 11:05am
2
Hi Axel,
On Mon, Nov 06, 2006 at 01:05:15AM +0900, Axel wrote:
Hello,
when trying to access a certain HTML-frame, I get:
“in `request’: Unhandled response (WWW::Mechanize::ResponseCodeError)”
and the page returns: “400 Bad Request”
Can you turning on logging, and forward that to the mechanize mailing
list? The URL in the frame may be getting clobbered, but I can’t tell
without looking at the logs.
http://rubyforge.org/mail/?group_id=1453
You also may want to get LiveHTTPHeaders for FireFox and compare the
output of that to your mechanize logs.
With browser, it works.
Thank you for any help!
Axel
[snip]
axel
November 7, 2006, 11:05am
3
Can you turning on logging, and forward that to the mechanize mailing
list?
I’ll try it this evening (because it is a private job). Logging is done
like this, right?:
require ‘logger’
agent = WWW::Mechanize.new {|a| a.log = Logger.new(STDERR) }
Yes, I’ll send the results to the mailing list.
You also may want to get LiveHTTPHeaders for FireFox and compare the
output of that to your mechanize logs.
Interesting, did not know about this; that will be my second step.
axel
November 7, 2006, 11:08am
4
On Mon, Nov 06, 2006 at 06:15:16PM +0900, Axel wrote:
Can you turning on logging, and forward that to the mechanize mailing
list?
I’ll try it this evening (because it is a private job). Logging is done
like this, right?:
require ‘logger’
agent = WWW::Mechanize.new {|a| a.log = Logger.new(STDERR) }
That is correct, or you can have it go to a file:
agent = WWW::Mechanize.new {|a| a.log = Logger.new(“some_file.txt”) }