Clicking link with JavaScript in Mechanize

前端 未结 3 1122
闹比i
闹比i 2021-01-03 03:47

I have this:

Account Summary

I want to c

3条回答
  •  既然无缘
    2021-01-03 04:42

    The first 2 should have worked so try this, print out the hrefs to make sure it's really there:

    puts page.links.map(&:href)
    

    Remember that just because you can see it in your browser does not mean it appears in the response. It could have been sent as an ajax update. Also you can just do this which I think is cleaner:

    page.link_with(:href => /menu_home/).click
    

    However I don't think clicking that link will do what you want since it's javascript.

提交回复
热议问题