qt - Setting input to QWebElement -
i have html page <input type=file>
i'm using qtwebkit , i'm able qwebelement of input type.
how set value specific string (file path) can submit form?
a naive thing set value
attribute of input
element.
element->setattribute("value", "path");
this not work, though, since you're not allowed set attribute unless you're "the browser".
probably way go use mozsetfilenamearray
, so:
const qstring filepath = "/foo/bar/baz"; // or "c:\foo\bar\baz" const qstring js = qstring( "var filearray = {'%1'};" "this.mozsetfilenamearray(filearray, filearray.length);" ).arg(filepath); element->evaluatejavascript(js);
Comments
Post a Comment