I’m working on a project where I need to automate the login process for web services like Gmail using the IWebBrowser2 interface. I want to know if this is technically feasible and how to implement it properly.
Here’s what I have so far:
WebController := CreateOleObject('InternetExplorer.Application') as IWebBrowser2;
WebController.Navigate('https://accounts.google.com');
I have stored my credentials in variables called userEmail
and userPass
, but I’m not sure how to programmatically fill in the login form fields and submit them. What additional methods or properties do I need to use to interact with the HTML elements on the Gmail sign-in page? I’m using IE8 as the underlying browser engine.
I’m relatively new to web automation programming, so any detailed guidance would be appreciated. Thanks for your help!
I’ve done similar automation work before - there’s more to consider than just the technical side. Sure, you can access the DOM through the Document property and mess with form elements, but Google’s got tons of anti-automation stuff that’ll mess you up. They use dynamic element IDs, throw CAPTCHAs at you, and fingerprint your device to catch bots. Plus, IE8? Google’s dropped support for old browsers and will probably just block your login outright. Even if you manage to submit credentials, Google will likely flag it as suspicious and make you jump through more hoops. I’d look into official APIs instead - way more reliable and you won’t be breaking their terms of service.
yeah, it’s doable but ie8 makes it tricky. you gotta grab the document object with WebController.Document, then find the input fields by id or name. something like doc.getElementById('identifierId').value := userEmail
and simulate clicking the next button. fair warning though - gmail’s security changes all the time, so this could break often.