Skip to content

Commit

Permalink
Show other ways of setting userAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
mfeckie authored and coreyti committed Sep 26, 2024
1 parent 5d09adf commit b717839
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/api/browser_context_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,21 @@ defmodule Playwright.BrowserContextTest do
end

describe "User Agent" do
test "should work", %{browser: browser} do
test "can be set via new_context", %{browser: browser} do
context = Browser.new_context(browser, %{"userAgent" => "Mozzies"})
page = BrowserContext.new_page(context)

assert Page.evaluate(page, "window.navigator.userAgent") == "Mozzies"

BrowserContext.close(context)
end

test "can be set via new_page", %{browser: browser} do
page = Browser.new_page(browser, %{"userAgent" => "Mozzies"})

assert Page.evaluate(page, "window.navigator.userAgent") == "Mozzies"

Page.close(page)
end
end
end
Expand Down

0 comments on commit b717839

Please sign in to comment.