1

When I was trying simple vb script to login gmail which inputs username and password automatically, got an error message "Object doesn't support this property or method: 'document'"

dim url
dim browser

url = "https://gmail.com"

set browser = createobject("wscript.shell")

browser.run(url)

wscript.sleep 100

set login = browser.document.getelementbyid("formUsername")

login.value = "[email protected]"

set login = browser.document.getelementbyid("formpassword")

login.value = "password"

set login = browser.document.Forms(0)

login.submit

do while (browser.busy)

wscript.sleep 10

loop

msgbox "You've successfully logged"

1 Answer 1

0
browser.run(url)

browser is a shell object. It knows that running a URL will open whatever your default web browser is, and go to that URL. That's it. It won't expose the DOM elements to your script.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.