setText
setText(objectOrName, text)
This function sets the text of the objectOrName
editable form element (which can be a text or textarea element) to the given text
. (Compare this with the typeText(objectOrName, text) function which simulates typing the text into the form element.)
A special use-case of this function is automation of upload fields. Form fields used to select files for uploading them can be automated via setText. The input fields name should be used for the objectOrName
and the the absolute path of the file to upload should be passed as the text
. The setText invocation will transparently handle the file selection across platforms and browsers.
Recording setText invocations on file upload fields can often not obtain the absolute path to the file on disk as browsers prevent access to this information for security reasons. Please make sure to adjust the parameter for the absolute path accordingly.
© 2024 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners.