How to use HoverTests method of PuppeteerSharp.Tests.ElementHandleTests.HoverTests class

Best Puppeteer-sharp code snippet using PuppeteerSharp.Tests.ElementHandleTests.HoverTests.HoverTests

Run Puppeteer-sharp automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.


Source: HoverTests.cs Github

1using System;
2using System.Threading.Tasks;
3using Xunit;
4using Xunit.Abstractions;
6namespace PuppeteerSharp.Tests.ElementHandleTests
8    [Collection(TestConstants.TestFixtureCollectionName)]
9    public class HoverTests : PuppeteerPageBaseTest
10    {
11        public HoverTests(ITestOutputHelper output) : base(output)
12        {
13        }
15        [Fact]
16        public async Task ShouldWork()
17        {
18            await Page.GoToAsync(TestConstants.ServerUrl + "/input/scrollable.html");
19            var button = await Page.QuerySelectorAsync("#button-6");
20            await button.HoverAsync();
21            Assert.Equal("button-6", await Page.EvaluateExpressionAsync<string>(
22                "document.querySelector('button:hover').id"));
23        }
24    }
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used method in HoverTests

Trigger HoverTests code on LambdaTest Cloud Grid

Execute automation tests with HoverTests on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)