Playwright Locator Issue

123 Views Asked by At

I am using Playwright trying to automate a button clicking action. I have tried to locate the HTML content through several methods, but will not click and proceed to the next screen.

Here is the HTML content:

[<button class="c-button checkoutConfirmButton--OXR5TyUP f-primary f-flex" data-bi-dnt="true" data-tv-strategy-up="projection" data-focus-rank="0">Checkout</button>]

Methods used so far:

page.get_by_role("button", name="Checkout").click()
page.get_by_text("Checkout", exact=True).click()
page.get_by_role("button", name="Checkout").click()

I expect the page to move to the next screen but the code refuses to interact. I've also added many print statements for errors and found out the button is not being located. Am I messing up my "locators" or should I use something else?

Note: This is the only content with "Checkout" on the page.

0

There are 0 best solutions below