Script ошибка при входе в Twitter с использованием Phantomjs

Я хочу войти в твиттер, используя Phantomjs. Это мой script:

var webpage = require('webpage');
var page = webpage.create();
page.settings.loadImages = false;
page.onConsoleMessage = function (msg) {
    console.log(msg);
};
var email = 'my email';
var pwd = "my password";
page.open('https://twitter.com/login');
do {
    phantom.page.sendEvent('mousemove');
} while (page.loading);
console.log('loaded login page')
page.evaluate(function (email, pwd) {
    function login(email, pwd) {
        var form = document.querySelector('form[action$="/sessions"]');
        form.elements['session[username_or_email]'].value = email;
        form.elements['session[password]'].value = pwd;
        form.submit();
    }
    login(email, pwd);
}, email, pwd);
do {
    phantom.page.sendEvent('mousemove');
} while (page.loading);
console.log('loged in');
page.render('twitter.png')

Когда я запускаю этот script, терминал регистрирует следующее сообщение об ошибке:

loaded login page
JQMIGRATE: Migrate is installed with logging active, version 1.4.1
Error: https://abs.twimg.com/c/swift/en-gb/bundle/frontpage.01324ab8f52ce79afb8fedf597ba8b395dcae2a9.js not loaded

  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:394 in onerror
  :0 in insertBefore
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:395 in scriptTagTransport
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:391 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:396 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:401 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:389 in then
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:398 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:389 in then
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:404 in fetch
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:391 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:389 in then
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:384 in L
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:1195 in a
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:474 in exports
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:1196
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:392 in complete
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:404 in b
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:392 in complete
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:398
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:392 in complete
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:403 in complete
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:403
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:414 in l
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:392 in complete
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:404 in b
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:392 in complete
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:398
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:392 in complete
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:403 in complete
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:403
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:414 in l
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:415
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:402 in fetch
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:391 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:389 in then
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:398 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:389 in then
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:404 in fetch
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:391 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:389 in then
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:384 in L
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:415
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:402 in fetch
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:391 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:389 in then
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:398 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:389 in then
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:404 in fetch
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:391 in start
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:389 in then
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:384 in L
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:1195
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:174 in j
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:177 in fireWith
  https://abs.twimg.com/c/swift/en-gb/init.1349f2c12e480d27ef8d05f80f51adc4678700c4.js:185 in ready
  :0 in sendEvent
loged in
JQMIGRATE: Migrate is installed with logging active, version 1.4.1
JQMIGRATE: jQuery.browser is deprecated

TypeError: undefined is not a constructor (evaluating 'a.canPlayType(b)')

  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:912
  :0 in some
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:912
  :0
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:912 in hasVideoSupport
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:918 in updateAddPhotoLabel
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:918 in updateInterface
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:918
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:483
  :0
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:79 in each
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:70 in each
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:483 in j
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:812 in attachChild
  :0
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:814
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:990
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:483
  :0
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:79 in each
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:70 in each
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:483 in j
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:812 in attachChild
  :0
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:814
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/bundle/boot.3ab43e7dc7e887c2043124faba956cf7bf0930f9.js:181
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:483
  :0
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:79 in each
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:70 in each
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:483 in j
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:812 in attachChild
  :0
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:814
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/bundle/boot.3ab43e7dc7e887c2043124faba956cf7bf0930f9.js:190
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:479
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:483
  :0
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:79 in each
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:70 in each
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:483 in j
  https://abs.twimg.com/c/swift/en/bundle/boot.3ab43e7dc7e887c2043124faba956cf7bf0930f9.js:322 in initialize
  https://abs.twimg.com/c/swift/en/bundle/boot.3ab43e7dc7e887c2043124faba956cf7bf0930f9.js:718 in exports
  https://abs.twimg.com/c/swift/en/bundle/timeline.27911653294bceb29f1e6b16199474128b75bc95.js:524 in exports
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:474
  :0 in forEach
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:474 in f
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:474 in d
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:404 in b
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:398
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:403 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:403
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:414 in l
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:404 in b
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:398
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:403 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:403
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:414 in l
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:404 in b
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:398
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:403 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:403
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:414 in l
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:404 in b
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:398
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:389 in then
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:398 in start
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:398
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:392 in complete
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:397 in loaded
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:401 in loaded
  https://abs.twimg.com/c/swift/en/init.f07d5eab9780a9929e1418b9ac3211e5adb0f581.js:395 in onload

Хотя есть некоторая ошибка, twitter.png показать мне, что я заходил в систему и попал на домашнюю страницу.

Похоже, что некоторые ошибки происходят на странице входа frontpage.js, init.js и домашней странице init.js. Возможно, они недоступны.

В журнале есть строка:

https://abs.twimg.com/c/swift/en-gb/init.js:185 in ready:0 in sendEvent

Возможно, это из-за sendEvent?

Я попытался войти в твиттер, используя ту же учетную запись в google chrome, в консоли отсутствует журнал ошибок.

Я просмотрел исходный код twitter, вот как твиттер включает frontpage.js и init.js на странице входа:

<link rel="preload" href="#" onclick="location.href='https://abs.twimg.com/c/swift/zh-cn/init.c6aa1bbc69dde2dd76305b380fe5362fc9a16887.js'; return false;" as="script">
<script src="https://abs.twimg.com/c/swift/zh-cn/init.c6aa1bbc69dde2dd76305b380fe5362fc9a16887.js" async=""></script>
<script id="LR7" type="text/javascript" async="" src="https://abs.twimg.com/c/swift/zh-cn/bundle/frontpage.ea10732f14d734fa4e318d9ea754383c43c55bca.js"></script>

Вот как твиттер включает init.js в код HTML на домашней странице:

<link rel="preload" href="#" onclick="location.href='https://abs.twimg.com/c/swift/zh-cn/init.c6aa1bbc69dde2dd76305b380fe5362fc9a16887.js'; return false;" as="script">
<script src="https://abs.twimg.com/c/swift/zh-cn/init.c6aa1bbc69dde2dd76305b380fe5362fc9a16887.js" async></script>

Я попытался войти в мобильный веб-сайт, т.е. замените 'https://twitter.com/login' на 'https://mobile.twitter.com/login', сообщение об ошибке отсутствует.