public async Task InputValueShouldWork()
        {
            await Page.GotoAsync(Server.Prefix + "/dom.html");

            await Page.SelectOptionAsync("#select", "foo");

            Assert.AreEqual("foo", await Page.InputValueAsync("#select"));

            await Page.FillAsync("#textarea", "text value");

            Assert.AreEqual("text value", await Page.InputValueAsync("#textarea"));

            await Page.FillAsync("#input", "input value");

            Assert.AreEqual("input value", await Page.InputValueAsync("#input"));

            var locator = Page.Locator("#input");

            Assert.AreEqual("input value", await locator.InputValueAsync());

            var e = await PlaywrightAssert.ThrowsAsync <PlaywrightException>(async() => await Page.InputValueAsync("#inner"));

            StringAssert.Contains("Node is not an <input>, <textarea> or <select> element", e.Message);

            var locator2 = Page.Locator("#inner");

            e = await PlaywrightAssert.ThrowsAsync <PlaywrightException>(async() => await locator2.InputValueAsync());

            StringAssert.Contains("Node is not an <input>, <textarea> or <select> element", e.Message);
        }
        public async Task ShouldThrowDueToStrictness2()
        {
            await Page.SetContentAsync("<select><option>One</option><option>Two</option></select>");

            var exception = await PlaywrightAssert.ThrowsAsync <PlaywrightException>(() => Page.Locator("option").EvaluateAsync("() => {}"));

            StringAssert.Contains("strict mode violation", exception.Message);
        }
        public async Task ShouldThrowDueToStrictness()
        {
            await Page.SetContentAsync("<div>A</div><div>B</div>");

            var exception = await PlaywrightAssert.ThrowsAsync <PlaywrightException>(() => Page.Locator("div").IsVisibleAsync());

            StringAssert.Contains("strict mode violation", exception.Message);
        }
        public async Task ShouldThrowOnCaptureWithNth()
        {
            await Page.SetContentAsync("<section><div><p>A</p></div></section>");

            var exception = await PlaywrightAssert.ThrowsAsync <PlaywrightException>(() => Page.Locator("*css=div >> p").Nth(1).ClickAsync());

            StringAssert.Contains("Can't query n-th element", exception.Message);
        }
        public async Task InnerTextShouldThrow()
        {
            await Page.SetContentAsync("<svg>text</svg>");

            var e = await PlaywrightAssert.ThrowsAsync <PlaywrightException>(async() => await Page.InnerTextAsync("svg"));

            StringAssert.Contains("Node is not an HTMLElement", e.Message);

            var locator = Page.Locator("svg");

            e = await PlaywrightAssert.ThrowsAsync <PlaywrightException>(async() => await locator.InnerTextAsync());

            StringAssert.Contains("Node is not an HTMLElement", e.Message);
        }
        public async Task ShouldPassFirefoxUserPreferences()
        {
            var firefoxUserPrefs = new Dictionary <string, object>
            {
                ["network.proxy.type"]      = 1,
                ["network.proxy.http"]      = "127.0.0.1",
                ["network.proxy.http_port"] = 333,
            };

            await using var browser = await BrowserType.LaunchAsync(new() { FirefoxUserPrefs = firefoxUserPrefs });

            var page = await browser.NewPageAsync();

            var exception = await PlaywrightAssert.ThrowsAsync <PlaywrightException>(() => page.GotoAsync("http://example.com"));

            StringAssert.Contains("NS_ERROR_PROXY_CONNECTION_REFUSED", exception.Message);
        }
        public async Task IsCheckedShouldWork()
        {
            await Page.SetContentAsync("<input type='checkbox' checked><div>Not a checkbox</div>");

            var element = Page.Locator("input");

            Assert.IsTrue(await element.IsCheckedAsync());
            Assert.IsTrue(await Page.IsCheckedAsync("input"));
            await element.EvaluateAsync <bool>("input => input.checked = false");

            Assert.IsFalse(await element.IsCheckedAsync());
            Assert.IsFalse(await Page.IsCheckedAsync("input"));

            var e = await PlaywrightAssert.ThrowsAsync <PlaywrightException>(async() => await Page.IsCheckedAsync("div"));

            StringAssert.Contains("Not a checkbox or radio button", e.Message);
        }