1、QT QWebengine运行JavaScript获取图片的数量

pView->page()->runJavaScript("document.getElementsByTagName(\"img\").length",[](QVariantresult){qDebug()<<result.toString();});

或者

structGetElementCountFunctor{GetElementCountFunctor(){}voidoperator()(constQVariant&result){qDebug()<<result.toString();}};pView->page()->runJavaScript("document.getElementsByTagName(\"img\").length",GetElementCountFunctor());