History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WTR-239
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: halfconscious
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Watir

FireWatir support for XML and generic non-HTML pages [patch]

Created: 20/Aug/08 02:02 AM   Updated: 28/Oct/08 06:09 PM
Component/s: FireWatir
Affects Version/s: Future
Fix Version/s: None

Original Estimate: 48h Remaining Estimate: 48h Time Spent: Unknown
File Attachments: 1. File firewatir-1.1.1.gem (92 kb)
2. File firewatir.rb.diff (0.2 kb)

Environment: Firewatir, all OS


 Description  « Hide
FireWatir requires support for XML in the long term. Related to this issue is the
requirement for an access method that will provide raw,unformatted page source regardless
of whether html/body tags are present in the page.

Firefox.html() is only useful when html / body tags are
present.
In the case where a generic xml page is encountered with no
html/body tags Firefox.html() returns
"<html>TypeError: htmlelem is undefined</html>"

Access to raw page data will allow users to find workarounds with
their own XML parsers, pending integrated XML support in FireWatir. It will
also allow FireWatir to access non HTML pages.

The author of this ticket is not aware if this is a restriction of the jssh console. I intend to investigate this in due course. Unfortunately I am new to ruby, and have only come to it in the last few days, via firewatir, so there will be some inertia to overcome ;0) .. although initial impressions are favourable .. python would have been easier for me that's all.



 All   Comments   Work Log   Change History      Sort Order:
halfconscious - 20/Aug/08 05:06 AM
FYI : I've found out I can make jssh give me the page source
       with the following
browser.loadURI("file:///home/hc/tmp/TEST.XML")
doc = browser.contentDocument
domDumpFull(doc)

Simply adding an access method to Firefox to retrieve these results would
provide new options for users to cope with xml and other non-html formats.

I am attempting to try this with a local version of FireWatir now



halfconscious - 20/Aug/08 05:45 AM
I've got what I want now , re: extracting raw page source, by adding the following
method to Firefox

        def raw_doc()
            $jssh_socket.send("domDumpFull( #{DOCUMENT_VAR} ) ;\n", 0)
            result = read_socket()
            return result
        end

I'm putting up a patch file - which was obtained by modifying the 1.1.1 firewatir-read-only
source. I sincerely hope that the maintainers apply this or something equivalent to
the development trunk asap. Thanks in advance

HC

halfconscious - 20/Aug/08 05:51 AM
This diff file was created from version 1.1.1 (read only) source
obtained from svn 20/8/08.


halfconscious - 20/Aug/08 05:55 AM
gem of modded FireWatir 1-1-1 which provides new Firefox method
raw_doc(), which returns unformatted page source and allows access
to xml and other non html page source.


Bret Pettichord - 28/Oct/08 06:09 PM
Patch is provided, but no tests. Code seems simple enough. We've had this functionality requested for Watir::IE as well. Actions:

1. Provide unit test for this functionality.
2. Decide on the best name for this method. (Not sure about "raw_doc").
3. Provide implementations for both FireWatir and Watir::IE.

In the mean time, users who need this can monkey-patch.