Jump to content

document.evaluate(XPath) in IE.au3 ?


4ggr35510n
 Share

Recommended Posts

Greetings!

I'm currently trying to reach some data in HTML pages threw XPath expressions. Works fine with FF.au3... But what about IE.au3?

I were trying to figure it out using this XML DOM wrapper, but apparently HTML has not many to do with XML...

Could anyone help me figure it out?

How to get node values from html document using xpath in InternetExplorer UDF?

I'll appreciate your help!

Best Regards,

4gr

Link to comment
Share on other sites

I think XPath is only parsed by special javascript included with the page, or an added plug-in, not by the native IE engine itself.

Others my know better.

;)

Edit: Here's at least one Googled reference with the same opinion: XPath in Javascript, Part 3:

In my previous two posts, I talked about the DOM Level 3 XPath Javascript implementation available in Firefox, Safari, Chrome, and Opera. Internet Explorer as of version 8 still hasn’t implemented this feature set, but it does have some support for XPath. Unlike the other browsers, Internet Explorer’s XPath functionality is available on XML documents and can’t be used on the document object.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

What kind of data are you trying to access? For example, if you're trying to access an input by value, you could use the following:

$oInputs = _IETagNameGetCollection($oIE, "input")
For $oInput In $oInputs
    If $oInput.value = "Click Me" Then _IEAction($oInput, "click")
Next

Edited by GMK
Link to comment
Share on other sites

THANK YOU both for you answers!

I'm noob about this and I'm googling terms like a blind man, confusing concepts etc., but...

I think XPath is a DOM standard, and a DOM standard is present both in HTML and XML.

Here W3C writes in "Select Nodes" paragraph about xmlDoc.selectNodes(xpath); technique in InternetExplorer, instead of xmlDoc.evaluate() present in Firefox/Opera/Chrome.

Here is something in MSDN about it, but I have no idea how to connect this with IE.object :|

$object.document.SelectNodes("//div")

PsaltyDS:

According to info you got, I should use 'SelectNodes' on XML object (which, apparently, as Dale said via PM, isn't $object.document). In further searches I've found THIS W3C page, telling about document object property "xml", that returns xml content of html document. But...

$object.document.xml.SelectNodes("//div") fails too, similar as $object.document.xml itself!

Anyone knows how to make it work? :/

GMK:

I'm familiar with *GetCollection, yet it doesn't meet my needs ;)

Edited by 4ggr35510n
Link to comment
Share on other sites

See this post about xpath not being integrated even in IE9 http://blog.brett-zamir.me/?p=169

IE Selector API might help you, but I have discounted it for my work since it requires the document you use it on to opt into the IE8 compliance mode... yeah right. The api uses the methods .querySelectorAll and .querySelector

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

From link you've pasted (thank you for this):

Nothing is changing here for IE9; if you want to use XPATH, you’ll need to use MSXML.

There is MSXML UDF on this forum... But is there any way to convert HTML document to XML in autoit?

Edited by 4ggr35510n
Link to comment
Share on other sites

No, not in any meaningful way I can think of.

Perhaps if you shre info on exactly what you are trying to accomplish there may be some approach that can be suggested.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...