Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rahulmr/c8d702391a2fe5745652884970d226f1 to your computer and use it in GitHub Desktop.
Save rahulmr/c8d702391a2fe5745652884970d226f1 to your computer and use it in GitHub Desktop.
Playwright Python Tutorial
import sys
sys.path.append(sys.path[0] + "/..")
from testScripts.parallelLoginBuyScript import LoginAndBuy
from playwright.sync_api import sync_playwright
with sync_playwright() as playwright:
try:
playwright = LoginAndBuy(playwright)
playwright.launchWeb()
playwright.fillEmail("[email protected]")
playwright.fillPassword("mypassword")
playwright.clickLogin()
playwright.fillSearchBox("Nikon")
playwright.clickSearchButton()
playwright.clickProduct()
playwright.clickAddToCart()
playwright.clickCheckOutModal()
playwright.hoverMenuBox()
playwright.clickLogout()
playwright.getSuccessStatus()
except:
playwright.getFailed()
playwright.closeBrowser()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment