Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Created September 6, 2022 16:41
Show Gist options
  • Save SarahElson/5b99072c1f60c7b73bd2acc62e40d30e to your computer and use it in GitHub Desktop.
Save SarahElson/5b99072c1f60c7b73bd2acc62e40d30e to your computer and use it in GitHub Desktop.
Playwright Python Tutorial: Getting Started With Python End To End Testing
import sys
sys.path.append(sys.path[0] + "/..")
from testScripts.singleLoginBuyScript import LoginAndBuy
from playwright.sync_api import sync_playwright
with sync_playwright() as playwright:
try:
playwright = LoginAndBuy(playwright)
playwright.launchWeb()
playwright.fillEmail("anEmailgmai@gmail.com")
playwright.fillPassword("mypassword")
playwright.clickLogin()
playwright.fillSearchBox("Nikon")
playwright.clickSearchButton()
playwright.clickProduct()
playwright.clickAddToCart()
playwright.clickCheckOutModal()
playwright.hoverMenuBox()
playwright.clickLogout()
playwright.getSuccessStatus()
except:
playwright.getFailedStatus()
playwright.closeBrowser()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment