WebFormManager
Added in version 2.40.
Superclasses: Object
Form manager of a WebPage
in a ScriptWorld
Methods
- class WebFormManager
- input_element_auto_fill(element: Value, value: str) None
Set the value of an HTML input element as if it had been edited by the user, triggering a change event, and set it as filled automatically. If
element
is not an HTML input element this function does nothing.Added in version 2.40.
- Parameters:
element – a
Value
value – the text to set
Signals
- class WebFormManager.signals
- form_controls_associated(frame: Frame, elements: Sequence[Value]) None
Emitted after form elements (or form associated elements) are associated to
frame
. This is useful to implement form auto filling for web pages where form fields are added dynamically. This signal might be emitted multiple times for the same frame.Note that this signal could be also emitted when form controls are moved between forms. In that case, the
elements
array carries the list of those elements which have moved.Clients should take a reference to the members of the
elements
array if it is desired to keep them alive after the signal handler returns.Added in version 2.40.
- Parameters:
frame – a
Frame
elements – a
GPtrArray
ofValue
with the list of forms in the page
- will_send_submit_event(form: Value, source_frame: Frame, target_frame: Frame) None
This signal is emitted when the DOM submit event is about to be fired for
form
. JavaScript code may rely on the submit event to detect that the user has clicked on a submit button, and to possibly cancel the form submission beforeWebFormManager
::will-submit-form signal is emitted. However, beware that, for historical reasons, the submit event is not emitted at all if the form submission is triggered by JavaScript. For these reasons, this signal may not be used to reliably detect whether a form will be submitted. Instead, use it to detect if a user has clicked on a form’s submit button even if JavaScript later cancels the form submission, or to read the values of the form’s fields even if JavaScript later clears certain fields before submitting. This may be needed, for example, to implement a robust browser password manager, as some misguided websites may use such techniques to attempt to thwart password managers.Added in version 2.40.
- will_submit_form(form: Value, source_frame: Frame, target_frame: Frame) None
This signal is emitted when
form
will imminently be submitted. It can no longer be cancelled. This event always occurs immediately before a form is submitted to its target, so use this event to reliably detect when a form is submitted. This signal is emitted afterWebFormManager
::will-send-submit-event if that signal is emitted.Added in version 2.40.
Fields
- class WebFormManager
- parent