That's not how things work. Most likely, whatever Javascript or HTML rendering tool you use will also support XPath or CSS selectors. Use these tools instead.
| [reply] [Watch: Dir/Any] |
Thank you for this precious advice.
I see two ways out of this:
1. i start this mini-project all over again (it's very doable : at the moment i'm only doing tests to identify the tools i should use), using XPath instead of HTML::Tree. Which will allow me to use this ->element_coordinate() function from WWW::Mechanize::Firefox.
2. i have found HTML::TreeBuilder::XPath which apparently enables to use both Trees and XPath. Could this enable me to use ->element_coordinates() from my tree nodes ?
I'm trying solution 2. I've been fighting to get this to work, and finally got to a point where i identified my obstacle :
Apparently, get_element_coordinate() takes a MozRepl::RemoteObject::Instance as an argument, and i didn't find how HTML::Tree::XPath could return me such an object from my HTML::Element tree node.
If someone had a simple solution to this, great.
Otherwize, i'll just start it again with XPAth. Which would be good for me to learn anyway.
As you can see, i'm learning as i go, and there's lots i have to learn. Any book / tutorial / website for me to learn would be very welcome. I like book-learning more than all. As an indication, i read "Perl & LWP" and "Spidering Hacks" already. But neither of them addresses the DOM (i'm not even sure what it is), nor Javascript (i did two tutorials, but it's not enough), nor XPath in depth, nor... all the important things i forget.
Thanks a lot for building this very useful library Corion, and for answering beginners' questions : it's very kind of you. Have a good day =o)
| [reply] [Watch: Dir/Any] |
WWW::Mechanize::Firefox only works with Firefox. There is no way to make HTML::TreeBuilder::XPath objects work with it.
Again, if you want element positions, you need Javascript. HTML::Tree / TreeBuilder don't do Javascript (or other HTML layout). WWW::Mechanize::Firefox does XPath and Javascript. It has other drawbacks, like needing a display.
| [reply] [Watch: Dir/Any] |