How to login into website using Mechanize

155 Views Asked by At

I'm trying to login to this website and I keep getting this error:

Mechanize::ResponseCodeError (404 => Net::HTTPNotFound for ...

I followed the documentation and changed the user agent but still have this problem:

require 'rubygems'
require 'mechanize'
require 'nokogiri'


USERNAME = 'myemail'
PASSWORD = 'mypassword'


mechanize = Mechanize.new
mechanize.user_agent_alias = 'Windows Chrome'
login_page = mechanize.get('https://bookcoverzone.com/')

form = login_page.forms[1]
form['email'] = USERNAME
form['password'] = PASSWORD
result = form.submit
0

There are 0 best solutions below