I've written a script in VBA in combination with IE to fill two input fields to login to a webpage.
When I try to execute my script, it throws Access is denied
error because of the iframe
within which the input fields are. How can I fill the two input fields with my credentials?
This is my try so far:
Sub LogIn()
Const Url = "replace with above link"
Dim IE As New InternetExplorer, HTML As HTMLDocument
Dim frm As Object, post As Object
With IE
.Visible = True
.navigate Url
While .Busy Or .readyState < 4: DoEvents: Wend
Set HTML = .document
End With
Application.Wait Now + TimeValue("00:00:05")
Set frm = HTML.querySelector("iframe[name='disneyid-iframe']").contentWindow.document
Set post = frm.querySelector("input[placeholder='Username or Email Address']")
post.Value = "somename@gmailmail.com"
End Sub
You can try with any input details. All I need to know is how can I fill the two boxes.
Html elements connected to iframe
content:
<iframe id="disneyid-secure-responder" name="disneyid-secure-responder" src="https://www.espn.com/disneyid/responder/index.html?clientId=ESPN-ONESITE.WEB-PROD&scheme=http&postMessageOrigin=http%3A%2F%2Ffantasy.espn.com%2Fbasketball%2Fteam%3FleagueId%3D24874190%26teamId%3D1%26statSplit%3DcurrSeason&cookieDomain=espn.com&config=PROD&logLevel=INFO&topHost=fantasy.espn.com&ageBand=ADULT&countryCode=CA&langPref=en-US&cssOverride=https%3A%2F%2Fsecure.espncdn.com%2Fcombiner%2Fc%3Fcss%3Ddisneyid%2Fcore.css%2Cdisneyid%2Ffantasy.css&responderPage=https%3A%2F%2Fwww.espn.com%2Fdisneyid%2Fresponder%2Findex.html&buildId=165f40c7564" style="display: none;"></iframe>