I'm trying to build a macro to go to a website, log in to an account, and retrieve data. The login form isn't on the web page as soon as it loads - you have to click a button first to make the form pop up. I'm getting an "object required" error message on the final line of the code below, even though I'm sure I have the correct object ID for the username field on the pop-up form.
Inspecting the username field gives:
If it's helpful to look at the website in question, you can see that at the link below. Pressing "Sign in" in the top right corner brings up the login form.
https://www.wizards.com/Magic/PlaneswalkerPoints/
Any ideas what I'm missing? Any help would be very much appreciated!
Code:
'Open IE and navicate to login page
Set IE = New InternetExplorer
IE.Visible = True
IE.navigate URL
Do Until IE.readyState = READYSTATE_COMPLETE: DoEvents: Loop
'Click login button to open form
Dim bLogIn As Object: Set bLogIn = IE.document.getElementById("SignInButton")
bLogIn.Click
Do Until IE.readyState = READYSTATE_COMPLETE: DoEvents: Loop
'Enter login info
IE.document.getElementById("username").Value = User
Inspecting the username field gives:
HTML:
<input class="textbox" data-state="0" data-val-error-location=".error-summary.title" data-val-invokable="true" data-val-invokable-event="login-fail" data-val-login-fail-error="Something's not quite right; please try again." data-val-required="true" data-val-required-error="This is a required field." id="username" maxlength="80" name="username" rel="0" type="text" value="">
If it's helpful to look at the website in question, you can see that at the link below. Pressing "Sign in" in the top right corner brings up the login form.
https://www.wizards.com/Magic/PlaneswalkerPoints/
Any ideas what I'm missing? Any help would be very much appreciated!