Search code examples
c#right-clickpuppeteer-sharp

Right click of a button in a website in C# using puppeteersharp


Need to perform right click of a button in a website in C# using puppeteersharp. Tried the below code but it is not working:

await page.ClickAsync({ button: 'right'}"[class*='_16aPYHYIOVxzNYTA4BGnwS NJVykX0WljoRws2qTYI5G _3FwRpWCSns-2PgbiDhEErG']");


Solution

  • You can use the ClickOptions argument:

    await page.ClickAsync(
        "[class*='_16aPYHYIOVxzNYTA4BGnwS NJVykX0WljoRws2qTYI5G _3FwRpWCSns-2PgbiDhEErG']", 
        new ClickOptions() { Button = MouseButton.Right } );