gregster wrote:euras wrote:
the page have this line:
Code: Select all
<META http-equiv=X-UA-Compatible content=IE=8;>
while my IE is 11. Can it be the problem?
I think so.
GetElementsbyClassName seems to need at least IE 9 (compare, for example,
https://developer.mozilla.org/de/docs/W ... yClassName). And as far as I understand FG, this is the case where you cannot do anything. The content mode to use is explicitly stated in the original html. Then, even the addition of the registry key won't help...
Yea, if the HTML from the website is specifically saying process the HTML code using IE 8 then it is hard to override that specific direction.
The website HTML is basically saying we only designed this HTML for IE 8 and we know it will work on IE 8 so only use IE 8 or anything else could cause problems.
All versions of IE have backward compatibility so even though you have IE 11 installed it runs in an emulation mode and runs using IE 8 rules, including methods and properties.
I have discovered no way to change the documentMode of a document once it has already processed the HTML code and created the document object from that HTML code.
Now on the plus side it is pretty easy to create a function that does the same thing as
GetElementsbyClassName.
Code: Select all
GetNodesByClassName(ByRef Doc, Names*)
{
Nodes := {}
for index, Name in Names
Needle .= Name "|"
Needle := "i)\b" SubStr(Needle,1,-1) "\b"
list := Doc.getElementsByTagName("*")
Count := list.length
loop %Count%
if (child := list[A_Index-1])
if (child.className ~= Needle)
Nodes.Push(child)
return Nodes
}
Then you can do stuff like this:
Code: Select all
GetNodesByClassName(oDocument,"customer")[1].outerHTML
This will get from oDocument all the nodes named "customer" then it will return the outerHTML of the first node. Elements and Nodes are pretty much the same thing.
FG