Skip to content

Instantly share code, notes, and snippets.

@avel
Last active June 8, 2021 13:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save avel/a3886a856fe035702aae to your computer and use it in GitHub Desktop.
Save avel/a3886a856fe035702aae to your computer and use it in GitHub Desktop.

Locators

element(by.<...>)

  • id
  • js
  • css
  • className
  • name
  • tagName
  • model
  • binding

All elements:

  • element.all()

    • count()
    • get(index)
    • first()
    • last()
    • filter(fn)
    • map(fn)
  • $$ = element.all(by.css())

Actions

  • click
  • sendKeys
  • clear
  • getAttribute
  • getText

Expect

  • not
  • toBe
  • toEqual
  • toContain
  • toMatch
  • toBeDefined
  • toBeTruthy
  • toBeLessThan
  • toBeGreaterThan
  • toBeCloseTo
  • toThrow

Browser

Debugging

  • debugger()
  • pause()
  • enterRepl()

Navigating

  • get(path)
  • refresh()
  • getLocationAbsUrl()

Other element methods

element.isDisplayed()

non-angular methods (e.g. for login)

browser.driver.get(env.baseUrl + '/...') browser.driver.findElement(by...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment