Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DevTools Docs Feedback] #2797

Closed
kennetherland87 opened this issue Aug 23, 2023 · 1 comment
Closed

[DevTools Docs Feedback] #2797

kennetherland87 opened this issue Aug 23, 2023 · 1 comment

Comments

@kennetherland87
Copy link

kennetherland87 commented Aug 23, 2023

What am I doing wrong? It hangs at:
var divs = devToolsContext.XPathAsync("//div").Result;

    public partial class WebViewControl : UserControl
    {
        private CoreWebView2 coreWebView;

        public WebViewControl()
        {
            InitializeComponent();
        }

        private async void CoreWebView_DOMContentLoaded(object sender, CoreWebView2DOMContentLoadedEventArgs e)
        {
            await webView.EnsureCoreWebView2Async();
            var devToolsContext = await coreWebView.CreateDevToolsContextAsync();

            switch (devToolsContext.Url)
            {
                case "https://www.google.com/":
                    {
                        // hangs!!
                        var divs = devToolsContext.XPathAsync("//div").Result;
                    }
                    break;
            }
        }

        private void WebViewControl_Load(object sender, EventArgs e)
        {
            webView.Source = new Uri("https://www.google.com");
        }

        private void webView_CoreWebView2InitializationCompleted(object sender, CoreWebView2InitializationCompletedEventArgs e)
        {
            coreWebView = webView.CoreWebView2;
            coreWebView.DOMContentLoaded += CoreWebView_DOMContentLoaded;
        }
    }

@captainbrosset
Copy link
Contributor

Thank you for reaching out. This question is specific to the WebView2 product, not its documentation. Therefore, could you please open a new issue for this over on the dedicated WebView2Feedback repository?

Here is the link: https://github.com/MicrosoftEdge/WebView2Feedback/issues/new

Thanks for your understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants