Here is my code I am using Python on Playwright as I previously used the selenium its working when you only call the context.driver in second step but on playwright it's returning me an error
File "features\steps\Login.py", line 14, in click_button
phoneBTN.click()
File "D:\Playwright\venv\Lib\site-packages\playwright\sync_api\_generated.py", line 14764, in click
self._sync(`your`your text` text`
File "D:\Playwright\venv\Lib\site-packages\playwright\_impl\_sync_base.py", line 102, in _sync
raise Error("Event loop is closed! Is Playwright already stopped?")
playwright._impl._errors.Error: Event loop is closed! Is Playwright already stopped?
from behave import given, then
from playwright.sync_api import sync_playwright
@given("the user navigates to the your website")
def navigate_to_your_website(context):
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
context.page = browser.new_page()
context.page.goto("https://website.com.pk/")
@then("the website homepage is displayed")
def click_button(context):
phoneBTN = context.page.locator(".non-auth-section .Continue-with-Phone-Number")
phoneBTN.click()
otpBTN = context.page.locator("#otp-number")
otpBTN.click()
I am working on Playwright I have tried it by using without steps it's working fine when I am using it in steps it's not working please help.