问题
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