如何使用Mechanize/Nokogiri获取页面源 [英] How to get the page source with Mechanize/Nokogiri
本文介绍了如何使用Mechanize/Nokogiri获取页面源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已使用Mechanize登录到网页/servlet.
I'm logged into a webpage/servlet using Mechanize.
我有一个页面对象:
jobShortListPg = agent.get(addressOfPage)
当我使用时:
puts jobShortListPg
我得到了不需要的页面机械化"版本:
I get the "mechanized" version of the page which I don't want:
#<Mechanize::Page::Link "Home" "blahICScriptProgramName=WEBLIB_MENU.ISCRIPT3.FieldFormula.IScript_DrillDown&target=main0&Level=0&RL=&navc=3171">
如何获取页面的HTML源代码?
How do I get the HTML source of the page instead?
推荐答案
使用.body
:
puts jobShortListPg.body
这篇关于如何使用Mechanize/Nokogiri获取页面源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文