From time to time I have used Powershell to bolt together adhoc web automations mostly for my own use at work to speed things up promote my own laziness. Each time I set something up the challenge always seemed to be working out the references to the elements of the ie.document that I need to influence.
Jaykul also posted a really helpful intro to using Selenium with Powershell which I can use too, but sooner or later I'm hitting essentially the same problem with the elements.
But, the question is really this:- How does a Web Automation Engineer (which I certainly am not!) figure out the references to the various elements in the page(s) they are trying to automate. There has to be a better more predictable way than looking at the element tag or name then "trying" it.
Is getting the ie.document and parsing all the elements really the only way? Maybe I am doing it wrong but it seems so hit and miss as well as time consuming.
by DonJ at 2012-11-20 08:49:34
There actually isn't a more reliable way than that. Every Web page is unique, so you pretty much have to look at it and figure it out, from scratch, every time. And yes, getting the IE document and parsing the elements, using the DOM, is pretty much the only way. It's hit or miss. And time consuming. You're spot-on with that remark! But that's the way it is. It's because Web page design/layout isn't in any way standardized.