Answer the question
In order to leave comments, you need to log in
How to login to adidas.ru using Ruby + Mechanize?
Can't login to https://www.adidas.ru/on/demandware.store/Sites-ad... . Even when submitting an empty form, after which the site is expected to say something like: "enter login / password", adidas redirects to the main page. Can you suggest what I'm doing wrong?
require 'rubygems'
require 'nokogiri'
require 'mechanize'
require 'open-uri'
def login_to_adidas
url = 'https://adidas.ru/on/demandware.store/Sites-adidas-RU-Site/ru_RU/MyAccount-CreateOrLogin'
agent = Mechanize.new
agent.user_agent_alias = 'Linux Mozilla'
agent.get(url) do |page|
form = page.form(id: "dwfrm_login")
form.field_with(name: "dwfrm_login_username").value = "[email protected]"
form.field_with(name: "dwfrm_login_password").value = "adidaspassword"
next_page = form.submit #не логинтся, а редиректит на главную
end
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question