Page 2 of 2

Re: eGet() - Grab Internet Explorer Elements Easily

Posted: 19 Mar 2019, 20:21
by 0x00
Just works, I work with IE a lot, so thanks for sharing.

Re: eGet() - Grab Internet Explorer Elements Easily

Posted: 11 Sep 2019, 13:55
by eekhelpspike
Thanks, this is great.

How do I click on this?

http://imgur.com/a/KfQz9tD

Re: eGet() - Grab Internet Explorer Elements Easily

Posted: 11 Sep 2019, 15:26
by berban
Hey eekhelpspike,

If it's tough to narrow down an element by its attributes (as it seems is the case there), you can sometimes access it more easily by grabbing a nearby element that has more defining information and then navigating across the DOM to your destination using some of the built-in properties.

Here's just a few examples of the built-in properties (you can also experiment with these in the Console window of F12):

Code: Select all

element.parentElement // the parent dom element
element.parentElement // the parent dom element
element.children[1] // the 2nd child element (array is zero-based)
element.lastChild // the last child element
element.previousSibling // the previous element on the same level
element.nextSibling // the next element on the same level
You can combine these to navigate back and forth.

Code: Select all

element.parentElement.previousSibling.children[0] // goes up one level, backwards one level, then down one level
Of course this will make things less reliable as it means your script could break if the developer changes the order of elements on the webpage, but it's a very quick and easy way to do things when in a bind.

Re: eGet() - Grab Internet Explorer Elements Easily

Posted: 11 Sep 2019, 15:31
by berban
Actually, I think I might have misread the screenshot. Does it not work if you just do eGet("button", "Login") ?

Re: eGet() - Grab Internet Explorer Elements Easily

Posted: 12 Sep 2019, 10:27
by eekhelpspike
berban wrote:
11 Sep 2019, 15:31
Actually, I think I might have misread the screenshot. Does it not work if you just do eGet("button", "Login") ?
Thank you for your responses!

It does not. Using eget, I was able to fill in the username password fields, but the button thing is eluding me, probably because I’m clueless when it comes to html.

The website does “disable” the button when username password values aren’t actually “typed” in, but I figured I would circle back around to that issue after I verified I can actually click this stupid login button by manually enabling it (i.e. typing in info manually then trying to use eget on the enabled button).