После отправки ничего не происходит с помощью Mechanize - PullRequest
0 голосов
/ 23 октября 2019

Когда я попытался отправить форму, я получил такой вывод:

=> #<Mechanize::Page
 {url #<URI::HTTPS https://host.com/Admin/Login.aspx>}
 {meta_refresh}
 {title "Edito .NET - Admin panel"}
 {iframes}
 {frames}
 {links}
 {forms
  #<Mechanize::Form
   {name nil}
   {method "POST"}
   {action "./Login.aspx"}
   {fields

    ...

    [text:0x2ad25ca5f998 type: text name: txtUser value: support2]
    [field:0x2ad25ca5f510 type: password name: txtPassword value: ]}
   {radiobuttons}
   {checkboxes [checkbox:0x2ad25ca5f240 type: checkbox name: chkPersistent value: false]}
   {file_uploads}
   {buttons [submit:0x2ad25ca5f088 type: submit name: btnLogin value: Log in]}>}>

Это код, который выполнил:

username = 'support2'
password = ''pass

agent = Mechanize.new
agent.user_agent_alias = 'Linux Mozilla'
agent.follow_meta_refresh = true
agent.redirect_ok = true
agent.keep_alive = true
agent.open_timeout = 30
agent.read_timeout = 30

page = agent.get(hostname)

login_form = page.forms.first
login_form["txtUser"] = username
login_form["txtPassword"] = password

page = agent.submit(login_form)

, но данные страницы должны быть обновлены. Я погуглил и не могу найти ответ на свой вопрос.

...