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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -