From 995bdefe1d34bdc263233d7df031702f58af0432 Mon Sep 17 00:00:00 2001 From: nebojsasandin Date: Sun, 3 Mar 2024 14:37:00 +0100 Subject: [PATCH] Adding test to replicate this issue: https://github.com/cefsharp/CefSharp/issues/4621 --- CefSharp.Test/OffScreen/OffScreenBrowserTests.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CefSharp.Test/OffScreen/OffScreenBrowserTests.cs b/CefSharp.Test/OffScreen/OffScreenBrowserTests.cs index 3766ac2065..a4b4d5aef3 100644 --- a/CefSharp.Test/OffScreen/OffScreenBrowserTests.cs +++ b/CefSharp.Test/OffScreen/OffScreenBrowserTests.cs @@ -30,7 +30,7 @@ public OffScreenBrowserTests(ITestOutputHelper output, CefSharpFixture fixture) [Fact] public async Task ShouldWorkWhenLoadingGoogle() { - using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler:false)) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); var mainFrame = browser.GetMainFrame(); @@ -41,6 +41,20 @@ public async Task ShouldWorkWhenLoadingGoogle() Assert.Equal(200, response.HttpStatusCode); output.WriteLine("Url {0}", mainFrame.Url); + + browser.Load("https://accounts.google.com/"); + var nav = await browser.WaitForNavigationAsync(); + mainFrame = browser.GetMainFrame(); + + Assert.True(nav.Success); + Assert.True(mainFrame.IsValid); + Assert.Contains("accounts.google", mainFrame.Url); + Assert.Equal(200, nav.HttpStatusCode); + + output.WriteLine("Url {0}", mainFrame.Url); + + var buttonText = await mainFrame.EvaluateScriptAsync("(function() { return document.querySelector(\"button[aria-haspopup='menu']\").innerText; })();"); + Assert.Equal("Create account", buttonText); } }