I Want to code a fake user click on a web view button to automatically load the right web page. I am working in Swift 2.0, the url doesn't contain any index page.
I want to click on the NOTES button, the url of the page is here:
You can simulate the button click using javascript, since the button is a browser element on the webview.
To run javascript through swift, use the evaluateJavaScript method. Using evaluateJavaScript() you can run any JavaScript in a WKWebView and read the result in Swift. This can be any JavaScript you want, which effectively means you can dig right into a page and pull out any kind of information you want.
webView.evaluateJavaScript("document.getElementById('theButtonElement').click()") { (result, error) in
if error != nil {
print(result)
}
}