'Splash login issue on NYT

It seems I cannot pass the login page of nytimes.com

My LUA script is:


function main(splash, args)
  --splash:init_cookies(splash.args.cookies)

  assert(splash:go(args.url))
  assert(splash:wait(2))
  assert(splash:go(splash.args.url))
  splash:set_viewport_full()
  local url = splash.args.url
  assert(splash:go(url))
  assert(splash:wait(1))

  splash:set_viewport_full()

 --  local search_input = splash:select('#username') 
 -- search_input:send_text("MyUsername")

  token = splash:evaljs("document.getElementById('authToken').value")

  splash:evaljs("document.getElementById('authToken').value = '"..token.."';")
 --token = splash:evaljs("document.getElementById('authToken').value")
 splash:evaljs("document.getElementById('username').value = 'MyUsername';")
 username =  splash:evaljs("document.getElementById('username').value")
  assert(splash:wait(1))
 splash:evaljs("document.getElementById('password').value = 'MyPassword';")
password =  splash:evaljs("document.getElementById('password').value")
assert(splash:wait(1))
splash:evaljs("document.getElementById('rememberMe').value = 'F';")
assert(splash:wait(1))
--local submit_button = splash:select('#submitButton')
submit_button = splash:evaljs("document.getElementById('submitButton')")
assert(splash:wait(10))
submit_button:click()
assert(splash:wait(2))
return {
  cookies = splash:get_cookies(),
  html = splash:html(),
  png = splash:png(),
  har = splash:har(),
  hidden_token=token,
  username=username,
  password = password,
}
end

I used this directly on the Splash browser with the login page:

https://myaccount.nytimes.com/auth/login

The fields (username, password and hidden) can be accessed, and are populated with the correct data. The button click works (or so it seems) but the result takes me to the same login page and advise me to register.

The #rememberMe checkbox is checked and this script cannot change its status. I am not sure this is contributing or not to failing to login.

Any suggestions? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source