XCTest - Xcode crashing when trying to record elements inside WKWebView

谁说我不能喝 提交于 2019-12-24 09:58:36

问题


Create a new Swift Xcode Single view project with UI test target.

In Main.storyboard select ViewController, then Editor/Embed in/Navigation Controller.

Change ViewController.swift to the following code:

import UIKit
import WebKit

class ViewController: UIViewController, WKNavigationDelegate
{
    var _webView: WKWebView!

    override func loadView()     {
        _webView = WKWebView()
        _webView.navigationDelegate = self
        view = _webView
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        let url = URL(string: "https://www.google.com")!
        _webView.load(URLRequest(url: url))
        _webView.allowsBackForwardNavigationGestures = true
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

In the generated UI test class (that extends from XCTestCase) position cursor in func testExample() body, hit the red record button.

Wait until the web view loaded the webpage.

Click inside the webview.

KABOOM! Xcode crashes!

Anyone have any solution for this? It's a game stopper for our UI test pipeline.

来源:https://stackoverflow.com/questions/50442216/xctest-xcode-crashing-when-trying-to-record-elements-inside-wkwebview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!