eGet() - Grab Internet Explorer Elements Easily
Re: eGet() - Grab Internet Explorer Elements Easily
Just works, I work with IE a lot, so thanks for sharing.
-
- Posts: 20
- Joined: 05 Jul 2015, 17:51
Re: eGet() - Grab Internet Explorer Elements Easily
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):
You can combine these to navigate back and forth.
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.
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
Code: Select all
element.parentElement.previousSibling.children[0] // goes up one level, backwards one level, then down one level
Re: eGet() - Grab Internet Explorer Elements Easily
Actually, I think I might have misread the screenshot. Does it not work if you just do eGet("button", "Login") ?
-
- Posts: 20
- Joined: 05 Jul 2015, 17:51
Re: eGet() - Grab Internet Explorer Elements Easily
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).