1
我在使用機械化登錄網站時遇到了一些問題。這裏是我的代碼。如何使用機械化來處理登錄後的自動翻頁?
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
page = agent.get("https://example.com/login")
login_form = page.forms.first
login_form.username = 'username'
login_form.password = 'password'
page = agent.submit(login_form)
pp page
但是我發現我登錄後有一個翻頁,當我使用我的瀏覽器時,它會持續約3秒。 所以它返回這樣一個頁面。
#<Mechanize::Page
{url #<URI::HTTPS:0xb6c5e764 URL:https://example.com/takelogin.php>}
{meta_refresh #<Mechanize::Page::MetaRefresh "" "index.php">}
{title nil}
{iframes}
{frames}
{links}
{forms}>
我想知道什麼我可以用它
非常感謝。 – user1668903