A
Axel
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"
* Why?
* How to solve this?
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
°°°°°°°°°°°°°°°°°°°°°
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
....
<!-- Wenn man nicht von start.jsp kommt, dann FS loesen (zB neutrale
Login Seite)-->
<script type="text/javascript">
if (parent.frames.length > 0 && parent.frames[0].name != 'mainframe')
parent.location="/diverse/indexKunde.jsp;jsessionid=fafdsfsd!-132!-12132";
</script>
<frameset rows="100,*" framespacing="0" border="0" frameborder="0">
<frame name="head"
src="/brokerdesign/default/head.jsp;jsessionid=fafdsfsd!-132!-12132"
scrolling="no" marginwidth="0" marginheight="0" noresize=""/>
<frameset cols="199,*" framespacing="0" border="0" frameborder="0">
<frameset rows="*,75,0" framespacing="0" border="0" frameborder="0">
<frame name="nav"
src="../diverse/navigation.jsp;jsessionid=fafdsfsd!-132!-12132?menu=1"
scrolling="no" marginwidth="0" marginheight="0" noresize=""/>
<frame name="ffblogo"
src="../diverse/ffblogoKunde.jsp;jsessionid=fafdsfsd!-132!-12132"
scrolling="no" marginwidth="0" marginheight="0" noresize=""/>
<frame name="keepSessionAlive"
src="../images/spacer.gif" scrolling="no" marginwidth="0"
marginheight="0" noresize=""/>
</frameset>
<frame name="main"
src="../action/depotuebersichtinit;jsessionid=fafdsfsd!-132!-12132"
scrolling="auto" marginwidth="0" marginheight="0" noresize=""/>
</frameset>
<noframes>
</noframes>
</frameset>
</html>
when trying to access a certain HTML-frame, I get:
"in `request': Unhandled response (WWW::Mechanize::ResponseCodeError)"
and the page returns: "400 Bad Request"
* Why?
* How to solve this?
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
°°°°°°°°°°°°°°°°°°°°°
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
....
<!-- Wenn man nicht von start.jsp kommt, dann FS loesen (zB neutrale
Login Seite)-->
<script type="text/javascript">
if (parent.frames.length > 0 && parent.frames[0].name != 'mainframe')
parent.location="/diverse/indexKunde.jsp;jsessionid=fafdsfsd!-132!-12132";
</script>
<frameset rows="100,*" framespacing="0" border="0" frameborder="0">
<frame name="head"
src="/brokerdesign/default/head.jsp;jsessionid=fafdsfsd!-132!-12132"
scrolling="no" marginwidth="0" marginheight="0" noresize=""/>
<frameset cols="199,*" framespacing="0" border="0" frameborder="0">
<frameset rows="*,75,0" framespacing="0" border="0" frameborder="0">
<frame name="nav"
src="../diverse/navigation.jsp;jsessionid=fafdsfsd!-132!-12132?menu=1"
scrolling="no" marginwidth="0" marginheight="0" noresize=""/>
<frame name="ffblogo"
src="../diverse/ffblogoKunde.jsp;jsessionid=fafdsfsd!-132!-12132"
scrolling="no" marginwidth="0" marginheight="0" noresize=""/>
<frame name="keepSessionAlive"
src="../images/spacer.gif" scrolling="no" marginwidth="0"
marginheight="0" noresize=""/>
</frameset>
<frame name="main"
src="../action/depotuebersichtinit;jsessionid=fafdsfsd!-132!-12132"
scrolling="auto" marginwidth="0" marginheight="0" noresize=""/>
</frameset>
<noframes>
</noframes>
</frameset>
</html>