Packages

Playwright is an Elixir library to automate Chromium, Firefox and WebKit browsers with a single API. Playwright delivers automation that is ever-green, capable, reliable and fast.

Current section

Files

Jump to
playwrightais lib playwright helpers expression.ex
Raw

lib/playwright/helpers/expression.ex

defmodule Playwright.Helpers.Expression do
@moduledoc false
# Page.evaluate(page, "function () { return 'lala'; }")
# Page.evaluate(page, "() => { return 'lala'; }")
# Page.evaluate(page, "() => 'lala'")
# Page.evaluate(page, "(thing) => { return thing; }")
# Page.evaluate(page, "(thing) => thing;")
# Page.evaluate(page, "thing => thing;")
def function?("function" <> _) do
true
end
def function?("() =>" <> _) do
true
end
def function?(expression) do
String.match?(expression, ~r/^[^=]+ =>/)
end
end