我愿从一个特定的URL制作网页的屏幕。 虽然有可能使用诸如Selenium RC之类的工具,但这需要一个制图环境。 我正在运行一个无头脑热托服务器。
这将成为诸如:
- Fetch URL
- Render HTML
- Export render as image file
- Store image file
我愿从一个特定的URL制作网页的屏幕。 虽然有可能使用诸如Selenium RC之类的工具,但这需要一个制图环境。 我正在运行一个无头脑热托服务器。
这将成为诸如:
如xvfb,你可以提出申请。 一种简单的做法就是用Qt基调来使网页贴上网基植被,并保持图像。 http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create- Screenshots-of-a-web-page-using-python-and-qtwebkit/“rel=”nofollow”blog post,概述了如何用做到这一点。
这里使用的是快速指挥线工具I ve。 这是自我使用以来的一段时期,但它仍然应当发挥作用!
#include <QtCore/QCoreApplication>
#include <QtGui>
#include <QtWebKit>
#include <QTextStream>
#include <QSize>
QWebView *view;
QString outfile;
void QWebView::loadFinished(bool ok)
{
QTextStream out(stdout);
if (!ok) {
out << "Page loading failed
";
return;
}
view->page()->setViewportSize(view->page()->currentFrame()->contentsSize());
QImage *img = new QImage(view->page()->viewportSize(), QImage::Format_ARGB32);
QPainter *paint = new QPainter(img);
view->page()->currentFrame()->render(paint);
paint->end();
if(!img->save(outfile, "png"))
out << "Save failure
";
QApplication::quit();
return;
}
int main(int argc, char *argv[])
{
QTextStream out(stdout);
if(argc < 3) {
out << "USAGE: " << argv[0] << " <url> <outfile>
";
return -1;
}
outfile = argv[2];
QApplication app(argc, argv);
view = new QWebView();
view->load(QUrl(argv[1]));
return app.exec();
}
I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...
<form><input type="file" name="first" onchange="jsFunction(2);"> <input type="file" name="second" onchange="jsFunction(3);"</form> Possible to pass just numbers to the js ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!