Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Set custom HTML #170

Closed
wants to merge 3 commits into from
Closed

Set custom HTML #170

wants to merge 3 commits into from

Conversation

niklasb
Copy link
Contributor

@niklasb niklasb commented Sep 24, 2011

  • Allows setting a custom HTML document and URL without issuing an HTTP request
  • Resources (Javascript/CSS) are fetched correctly after loading the HTML
  • Includes specs

General information about my pull requests

As I decided to use capybara and capybara-webkit for screen scraping tasks, I added some new procedures to the webkit_server and Capybara::WebKit::Browser that provide an interface to some of the underlying QtWebKit's advanced functionality.
A possible use case for this is that one can use a fast Javascript-unaware scraper like Mechanize or Net::HTTP and upgrade to a Javascript-aware browser-session using capybara-webkit only as long as dynamic content has to be accessed.

Pull requests that belong to this group of changes:

  • _Advanced cookie management_
  • _Set custom HTML_

Note: Because I had to add several C++ source files and headers to webkit_server, I decided to give the webkit_server.pro a nicer and more version control friendly layout. This is of course optional, I don't know whether this file is somehow auto-generated?

This problem was analyzed in detail by Brian Buchanan here:
thoughtbot#39
This fix is the same as for the Visit command in the master branch.
message = page()->failureString();

disconnect(page(), SIGNAL(pageFinished(bool)), this,
SLOT(loadFinished(bool)));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same fix as for the Visit command. Also needs a test?

@halogenandtoast
Copy link
Contributor

I think the use case you've described is beyond the scope of what we'd like to maintain. If more people run into a need for this perhaps I'll reconsider, but for the time being I'm going to close this.

@niklasb
Copy link
Contributor Author

niklasb commented Jan 13, 2012

@halogenandtoast: I see.

If somebody is interested in this, I opened a fork of the server at https://github.com/niklasb/webkit-server. Also includes Python bindings.

@david
Copy link

david commented Apr 4, 2012

I think this would actually be a very nifty solution to test html emails. I would be able to extract the html content, pass it to capybara-webkit, render it for debugging purposes, and even use capybara's methods.

Is there a simpler way to do what I mentioned that I'm not aware of?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants