Visual Basic - Button on website doesnt have an ID

68 views Asked by At

I'm trying to build a application which logs you into instagram. I've got it to input the username + password no problem

However, when i go to get the ID for the submit button their isnt one.. and i've been using .GetElementById. Is their anyway around this?

I'm pretty new to visual basic so please dumb it down to simpleton terms! Thank you in advance!

2

There are 2 answers

1
user3483948 On BEST ANSWER

Getting elements by ID is not the only solution. You can always get them by it's names or you can find the element by yourself. Just look at the whole page's source code, search for something spesific that button carries and invoke it. Visual basic's library can be insufficient for situations like that.

0
JoeIsBlogging On
  WebBrowser1.Document.GetElementById("username").InvokeMember("select")
            WebBrowser1.Document.ActiveElement.Focus()
            SendKeys.Send("{ENTER}")

This is the code that works! Change the "username" ID to the form you will be changing, then it focuses onto it and presses enter! Simulating the submit button.