title: Accessing DOM element in WKwebView
body: <p>In swift 2.1, Xcode7.1.1</p>
  <p>My code loads a local index.html into a WKwebView. How can I have a reference to the textFields so that I can set some of their properties? like <code>myWebViewTextField.userInteractionEnabled = false</code> or <code>myWebViewTextField.enabled = false</code></p>
  <p>The <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Classes/WebScriptObject_Class/index.html#//apple_ref/occ/cl/WebScriptObject" rel="nofollow noreferrer">docs</a> says:</p>
  <blockquote>
  <p>You get a window WebScriptObject object by sending windowScriptObject to your WebView object.</p>
  </blockquote>
  <p>I am not sure how to go from here. Thank</p>
  <pre><code>import UIKit
  import WebKit
  
  class ViewController: UIViewController {
  @IBOutlet var containerView: UIView! = nil  //allows the class to refrence WKWebView
  var webView: WKWebView?
  
  override func loadView() {
      super.loadView()
  
      self.webView = WKWebView()
      self.view = self.webView!
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
      //path explained http://www.cs.tut.fi/~jkorpela/fileurl.html
      let baseUrl = NSURL(string: &quot;file:///&lt;path&gt;/&quot;)
      let path = NSBundle.mainBundle().pathForResource(&quot;index&quot;, ofType: &quot;html&quot;)
      let HTMLString: NSString?
  
      do {
          HTMLString = try NSString(contentsOfFile: path!, encoding: NSUTF8StringEncoding)
          webView!.loadHTMLString(HTMLString as! String, baseURL: baseUrl )
  
      } catch {
          HTMLString = nil
      }
  }
  </code></pre>