Assuming that you have added a UIWebView
in your view controller and loaded a web page with a form in it, you can fill the form programmatically using the following steps:
main.swift26 chars2 lines
stringByEvaluatingJavaScript(from:)
function of the web view object:main.swift31 chars2 lines
value
property of the input element. You need to provide the name of the form input and the value that you want to set:main.swift49 chars2 lines
stringByEvaluatingJavaScript(from:)
function of the web view object with the JavaScript code to set the form data:main.swift53 chars2 lines
With the above steps, you should be able to fill the form inside the web view programmatically.
gistlibby LogSnag