[Interest] Handle frames and web forms with QWebEngine

NoRulez norulez at me.com
Thu Nov 19 17:29:24 CET 2015


I tried to use m_pWebEngineView->page()->runJavaScript() after the site is loaded, but it returns QVariant(QVariantMap, QMap()) for most of the time.

It seems that it can handle only simple queries like "document.title" but not for example "window.frames['MyFrame].document.forms[0].elements".
With which I expect a list of maps or similar to get the form elements.

Best Regards

> Am 18.11.2015 um 16:40 schrieb Koehne Kai <Kai.Koehne at theqtcompany.com>:
> 
> 
> 
>> -----Original Message-----
>> From: NoRulez [mailto:norulez at me.com]
>> Sent: Wednesday, November 18, 2015 12:20 PM
>> To: Koehne Kai <Kai.Koehne at theqtcompany.com>
>> Cc: Qt Project MailingList <interest at qt-project.org>
>> Subject: Re: [Interest] Handle frames and web forms with QWebEngine
>> 
>> Is there an example for such approach?
> 
> Probably not for your specific request, but there's the 'fancybrowser' example that shows how to inject JavaScript:
> 
> https://doc-snapshots.qt.io/qt5-5.6/qtwebengine-webenginewidgets-fancybrowser-example.html
> 
> We recently also just added a 'markdowneditor' example demonstrating the use of QWebChannel:
> 
> https://doc-snapshots.qt.io/qt5-5.6/qtwebengine-webenginewidgets-markdowneditor-example.html
> 
> Regards
> 
> Kai
> 
> 
>>>> Am 18.11.2015 um 10:12 schrieb Koehne Kai
>>> <Kai.Koehne at theqtcompany.com>:
>>> 
>>> 
>>> 
>>>> -----Original Message-----
>>>> From: Interest [mailto:interest-bounces at qt-project.org] On Behalf Of
>>>> NoRulez
>>>> 
>>>> Hi,
>>>> 
>>>> What is the preferred way to handle web forms (iterate over it like
>>>> QWebCollection does in QWebKit), search for frames by name and get
>>>> notified when a frame is created? (Was a signal in QWebKit)
>>> 
>>> The general approach is to load/inject JavaScript into the page that takes care
>> of this, and communicates with the C++ world either by return value, or
>> QWebChannel.
>>> 
>>> Hope this helps,
>>> 
>>> Kai



More information about the Interest mailing list