eGet() - Grab Internet Explorer Elements Easily

Post your working scripts, libraries and tools for AHK v1.1 and older
0x00
Posts: 89
Joined: 22 Jan 2019, 13:12

Re: eGet() - Grab Internet Explorer Elements Easily

19 Mar 2019, 20:21

Just works, I work with IE a lot, so thanks for sharing.
eekhelpspike
Posts: 20
Joined: 05 Jul 2015, 17:51

Re: eGet() - Grab Internet Explorer Elements Easily

11 Sep 2019, 13:55

Thanks, this is great.

How do I click on this?

http://imgur.com/a/KfQz9tD
User avatar
berban
Posts: 97
Joined: 14 Apr 2014, 03:20

Re: eGet() - Grab Internet Explorer Elements Easily

11 Sep 2019, 15:26

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.
User avatar
berban
Posts: 97
Joined: 14 Apr 2014, 03:20

Re: eGet() - Grab Internet Explorer Elements Easily

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") ?
eekhelpspike
Posts: 20
Joined: 05 Jul 2015, 17:51

Re: eGet() - Grab Internet Explorer Elements Easily

12 Sep 2019, 10:27

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).

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: gongnl, gwarble, hiahkforum and 62 guests