Use playwright to test the iframe, and if the browser uses Chromium, everything works normally. But when trying to use Firefox, click a link or button in the iframe, and then get the page title. The program does not wait for the end of the page navigation to get the page title immediately, resulting in inconsistent results between the program execution in Chromium and Firefox. How do I use the same code? And to ensure the consistent results of the implementation.
Below is a simple example of simulation
using PlaywrightSharp;
using System;
using System.Threading.Tasks;
namespace AutomationTesting
{
class Program
{
static async Task Main(string[] args)
{
using var playwright = await Playwright.CreateAsync();
await using var browserChromium = await playwright.Chromium.LaunchAsync();
await ShowTitle(browserChromium);
await using var browserFirefox = await playwright.Firefox.LaunchAsync();
await ShowTitle(browserFirefox);
}
private static async Task ShowTitle(IBrowser browser)
{
var page = await browser.NewPageAsync();
await page.GoToAsync("https://iframetester.com/?url=https://www.bing.com");
await page.Frames[1].ClickAsync("#scpl0");
Console.WriteLine(await page.Frames[1].GetTitleAsync());
}
}
}
Use playwright to test the iframe, and if the browser uses Chromium, everything works normally. But when trying to use Firefox, click a link or button in the iframe, and then get the page title. The program does not wait for the end of the page navigation to get the page title immediately, resulting in inconsistent results between the program execution in Chromium and Firefox. How do I use the same code? And to ensure the consistent results of the implementation.
Below is a simple example of simulation
PlaywrightSharp Version="0.191.2"