Reputation: 43
I was able to fill in the three fields in my webview successfully but couldn't submit the form :
let fillForm = String(format:"document.getElementById('Login').value = '\(login ?? "NA")';document.getElementById('Password').value = '\(password ?? "NA")';document.getElementById('Server').value = '\(server ?? "NA")';")
WebApp.stringByEvaluatingJavaScript(from: fillForm)
let Submit = String(format: "document.getElementByvalue('Login').submit()")
WebApp.stringByEvaluatingJavaScript(from: Submit)
I couldn't find an "id" for the Submit button like the others by "inspect element", so i tried to get the element by "value" tag.
input type="submit" value="Login" class="btn btn-default"
Please advise.
Upvotes: 1
Views: 978
Reputation: 43
Solved!
let submit = String(format:"document.forms[0].submit()")
Upvotes: 1