From 800cbcf0fd58d85bfa0c3f57636ddfa823a1b830 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Sun, 24 Mar 2024 15:19:36 +1000 Subject: [PATCH] Test - Add reproduction for issue 4621 https://github.com/cefsharp/CefSharp/issues/4621 --- CefSharp.Test/Issues/Issue4621.cs | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 CefSharp.Test/Issues/Issue4621.cs diff --git a/CefSharp.Test/Issues/Issue4621.cs b/CefSharp.Test/Issues/Issue4621.cs new file mode 100644 index 000000000..95e454d1c --- /dev/null +++ b/CefSharp.Test/Issues/Issue4621.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CefSharp.OffScreen; +using Xunit; +using Xunit.Abstractions; + +namespace CefSharp.Test.Issues +{ + //NOTE: All Test classes must be part of this collection as it manages the Cef Initialize/Shutdown lifecycle + [Collection(CefSharpFixtureCollection.Key)] + public class Issue4621 + { + private readonly ITestOutputHelper output; + + public Issue4621(ITestOutputHelper output) + { + this.output = output; + } + + [Fact(Skip = "Issue https://github.com/cefsharp/CefSharp/issues/4621")] + public async Task GoogleSearchToGoogleAccountsBreaksJS() + { + using (var browser = new ChromiumWebBrowser("https://www.google.com", useLegacyRenderHandler: false)) + { + var initialResponse = await browser.WaitForInitialLoadAsync(); + + var response = await browser.LoadUrlAsync("https://accounts.google.com/"); + var mainFrame = browser.GetMainFrame(); + + Assert.True(response.Success); + Assert.True(mainFrame.IsValid); + Assert.Contains("accounts.google", mainFrame.Url); + Assert.Equal(200, response.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); + } + } + } +}