getElementByXpath in IE web scraping

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DanielToward13
Posts: 74
Joined: 18 May 2017, 10:56

getElementByXpath in IE web scraping

25 Oct 2019, 01:17

Is it possible to get an element by Xpath in IE web scraping using AHK?
I know this is easy using Selenium, Beautifulsoup and all other tools out there but for some reasons, I have to do it in IE COM. My Xpath is

Code: Select all

//*[@id='minContainer']/div/div/div[div/span[contains(text(),'12345')]]/following-sibling::div/button
I want to find the element and then click on it.
DanielToward13
Posts: 74
Joined: 18 May 2017, 10:56

Re: getElementByXpath in IE web scraping

31 Oct 2019, 01:47

UPDATE: How to inject JS to IE COM? The getElementByXpath function can be defined in JS as

Code: Select all

function getElementByXpath(path) {{}return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;{}}
but how to inject it to the DOM?
gregster
Posts: 9113
Joined: 30 Sep 2013, 06:48

Re: getElementByXpath in IE web scraping

31 Oct 2019, 02:11

Xpath and IE seems generally like a bad combination. What about other ways to identify the element?

(evaluate isn't supported by IE, afaik: https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate )

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], bobstoner289, peter_ahk, Spawnova and 348 guests