Get a link's “href” using mechanize

£可爱£侵袭症+ 提交于 2019-12-12 01:25:19

问题


I wanna get href value of a link with a specific class name (in this case class name contains word fbxWelcomeBoxBlock)

I tried

@agent = Mechanize.new
page=@agent.get("https://www.facebook.com/")
mylinks=page.links_with(:class => 'fbxWelcomeBoxBlock _8o _8s lfloat _ohe')
puts mylinks.size  # prints zero now...

but it didnt work . (I am using mechanize in ruby now)


回答1:


It's fully dynamic page. Mechanize does not execute JS.



来源:https://stackoverflow.com/questions/28908915/get-a-links-href-using-mechanize

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!