The problem is this: on the page https://www.instagram.com/accounts/login/ you need to use JS to fill in the form data and click on the "Login" button.

enter image description here

When the "value" attribute is set , the inputs seem to be filled in, but when you click on "Enter", the fields are reset to empty values. The same is observed if you fill in one of the fields and start typing in another. I would be grateful for any help on the topic.

Pure JS or JQuery - does not matter, if only the values ​​are not reset.

PS: none of the ways of setting the value attribute known to me works:

  • document.getElementsByTagName('input')[0].setAttribute('value', 'bla-bla-bla')
  • document.getElementsByTagName('input')[0].value = 'bla-bla-bla'
  • $('input[name="username"]').val('bla-bla-bla')
  • $('input[name="username"]').attr('value', 'bla-bla-bla')
  • $('input[name="username"]').prop('value', 'bla-bla-bla')

There are suspicions that some event should be initialized, but which one could not be unzipped.

  • Try to copy-paste through JS there, mb there the assignment of values ​​on the input / keydown is underway, try to focus before that. In general, repeat all the same manipulations that an ordinary user would do. - SLy_huh
  • By means of js is through a browser extension that is? - Duck Learns to Take Cover
  • @ Moderately Tilting Undo Obviously yes. - GroZa
  • @Morely tilting as you like, I need to do this in WebView in javaFX and I'm just in a stupor, because filling in the fields does not work. But something has to work, since in the same Chrome the native form auto-completion is worked out the same. - user3270550
  • For Vkashnogo window is rolled. And the fact that the fields are reset to empty - maybe the login / password is not correct? Or is he just dropping everything? - Andrew Bystrov

1 answer 1

If this is possible, I do not think that it is good practice, if it is used for widespread use, it means that users should enter their confidential data (login and password) somewhere on your service and not on the instagram page.

Ps on python through the splinter extension there were no problems with such a task, I received the page element by name and filled it out.

  • Fortunately (or unfortunately, I don’t know), this hand-made article is not intended for wide use. Just a small program for private use. For now, I walk around the entrance in a roundabout way: login through facebook, but something tells me that this is somehow through ***. The instagram API is not an option because for my purposes it’s like a cannon on sparrows, and full access to the API cannot be obtained without an application ready for release. And since there is no question about any releases ... In general, thank you all for your attention, all I understood is that if someone knows how to get around, it will not crack) - user3270550
  • Why won't it split? I’m saying on the python bypass the splinter module. And by the way, they definitely cannot do it just from the code, that is, it will not work to send the request simply. In any case, you need something that emulates a browser. Look in the direction of phantomJS it seems like exactly for this. - justyx