1、QT QWebengine运行JavaScript获取图片的数量
pView->page()->runJavaScript("document.getElementsByTagName(\"img\").length", [] (QVariant result) { qDebug() << result.toString(); });
或者
struct GetElementCountFunctor { GetElementCountFunctor(){ } void operator()(const QVariant &result) { qDebug() << result.toString(); } }; pView->page()->runJavaScript("document.getElementsByTagName(\"img\").length", GetElementCountFunctor());