2021-01-01 15:17:27 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								id: auth
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								title: "Authentication"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Playwright can be used to automate scenarios that require authentication.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Tests written with Playwright execute in isolated clean-slate environments called
							 
						 
					
						
							
								
									
										
										
										
											2021-11-09 07:42:04 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								[browser contexts ](./browser-contexts.md ). This isolation model
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								improves reproducibility and prevents cascading test failures. New browser
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								contexts can load existing authentication state. This eliminates the need to
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								login in every context and speeds up test execution.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								>  Note: This guide covers cookie/token-based authentication (logging in via the
  
						 
					
						
							
								
									
										
										
										
											2021-01-06 11:59:29 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								app UI). For [HTTP authentication ](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication ) use [`method: Browser.newContext` ].
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-01 15:17:27 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								<!--  TOC  -->  
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Automate logging in
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The Playwright API can automate interaction with a login form. See
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[Input guide ](./input.md ) for more details.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The following example automates login on GitHub. Once these steps are executed,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								the browser context will be authenticated.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const page = await context.newPage();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.goto('https://github.com/login');
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Interact with login form
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.click('text=Login');
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.fill('input[name="login"]', USERNAME);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.fill('input[name="password"]', PASSWORD);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.click('text=Submit');
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Verify app is logged in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```java
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Page page = context.newPage();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.navigate("https://github.com/login");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Interact with login form
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.click("text=Login");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.fill("input[name='login']", USERNAME);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.fill("input[name='password']", PASSWORD);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.click("text=Submit");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Verify app is logged in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 09:34:49 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```python async
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								page = await context.new_page()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.goto('https://github.com/login')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Interact with login form
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.click('text=Login')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.fill('input[name="login"]', USERNAME)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.fill('input[name="password"]', PASSWORD)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.click('text=Submit')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Verify app is logged in
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 09:34:49 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```python sync
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								page = context.new_page()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.goto('https://github.com/login')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Interact with login form
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.click('text=Login')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.fill('input[name="login"]', USERNAME)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.fill('input[name="password"]', PASSWORD)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								page.click('text=Submit')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Verify app is logged in
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 08:20:21 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```csharp
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								var page = await context.NewPageAsync();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.NavigateAsync("https://github.com/login");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Interact with login form
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.ClickAsync("text=Login");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.FillAsync("input[name='login']", USERNAME);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.FillAsync("input[name='password']", PASSWORD);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await page.ClickAsync("text=Submit");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Verify app is logged in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								These steps can be executed for every browser context. However, redoing login
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								for every test can slow down test execution. To prevent that, we will reuse
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								existing authentication state in new browser contexts.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Reuse authentication state
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Web apps use cookie-based or token-based authentication, where authenticated
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								state is stored as [cookies ](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								or in [local storage ](https://developer.mozilla.org/en-US/docs/Web/API/Storage ).
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 16:36:52 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Playwright provides [`method: BrowserContext.storageState` ] method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state.
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Cookies and local storage state can be used across different browsers. They depend
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								on your application's authentication model: some apps might require both cookies
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								and local storage.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 12:24:10 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The following code snippet retrieves state from an authenticated context and
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								creates a new context with that state.
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Save storage state into the file.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await context.storageState({ path: 'state.json' });
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Create a new context with the saved storage state.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const context = await browser.newContext({ storageState: 'state.json' });
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```java
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Save storage state into the file.
							 
						 
					
						
							
								
									
										
										
										
											2021-08-12 01:49:56 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								context.storageState(new BrowserContext.StorageStateOptions().setPath(Paths.get("state.json")));
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Create a new context with the saved storage state.
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								BrowserContext context = browser.newContext(
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  new Browser.NewContextOptions().setStorageStatePath(Paths.get("state.json")));
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 09:34:49 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```python async
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# Save storage state into the file.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								storage = await context.storage_state(path="state.json")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Create a new context with the saved storage state.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								context = await browser.new_context(storage_state="state.json")
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 09:34:49 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```python sync
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# Save storage state into the file.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								storage = context.storage_state(path="state.json")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Create a new context with the saved storage state.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								context = browser.new_context(storage_state="state.json")
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 08:20:21 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```csharp
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Save storage state into the file.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await context.StorageStateAsync(new BrowserContextStorageStateOptions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    Path = "state.json"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								});
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 08:20:21 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Create a new context with the saved storage state.
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 08:20:21 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								var context = await browser.NewContextAsync(new BrowserNewContextOptions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    StorageStatePath = "state.json"
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 08:20:21 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								});
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 19:26:09 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Code generation
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 08:12:39 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Logging in via the UI and then reusing authentication state can be combined to
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								implement **login once and run multiple scenarios** . The lifecycle looks like:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Run tests (for example, with `npm run test` ). 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Login via UI and retrieve authentication state. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  In Jest, this can be executed in [`globalSetup` ](https://jestjs.io/docs/en/configuration#globalsetup-string ).
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  In each test, load authentication state in `beforeEach`  or `beforeAll`  step. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								This approach will also **work in CI environments** , since it does not rely on any external state.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### API reference
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [`method: BrowserContext.storageState` ] 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [`method: Browser.newContext` ] 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Session storage
  
						 
					
						
							
								
									
										
										
										
											2021-01-08 12:24:10 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 08:12:39 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Rarely, [session storage ](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage ) is used for storing information
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								associated with the logged-in state. Session storage is specific to a particular domain and is not persisted across page loads.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Playwright does not provide API to persist session storage, but the following snippet can be used to
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								save/load session storage.
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Get session storage and store as env variable
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const sessionStorage = await page.evaluate(() => JSON.stringify(sessionStorage));
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								process.env.SESSION_STORAGE = sessionStorage;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Set session storage in a new context
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const sessionStorage = process.env.SESSION_STORAGE;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await context.addInitScript(storage => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if (window.location.hostname === 'example.com') {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const entries = JSON.parse(storage);
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 16:51:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    for (const [key, value] of Object.entries(entries)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      window.sessionStorage.setItem(key, value);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}, sessionStorage);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```java
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Get session storage and store as env variable
							 
						 
					
						
							
								
									
										
										
										
											2021-07-09 11:51:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								String sessionStorage = (String) page.evaluate("JSON.stringify(sessionStorage)");
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								System.getenv().put("SESSION_STORAGE", sessionStorage);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Set session storage in a new context
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								String sessionStorage = System.getenv("SESSION_STORAGE");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								context.addInitScript("(storage => {\n" +
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "  if (window.location.hostname === 'example.com') {\n" +
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "    const entries = JSON.parse(storage);\n" +
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 16:51:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "     for (const [key, value] of Object.entries(entries)) {\n" +
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "      window.sessionStorage.setItem(key, value);\n" +
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "    };\n" +
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "  }\n" +
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 16:51:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "})('" + sessionStorage + "')");
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 09:34:49 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```python async
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import os
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Get session storage and store as env variable
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								session_storage = await page.evaluate("() => JSON.stringify(sessionStorage)")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								os.environ["SESSION_STORAGE"] = session_storage
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Set session storage in a new context
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								session_storage = os.environ["SESSION_STORAGE"]
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 16:51:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								await context.add_init_script("""(storage => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if (window.location.hostname === 'example.com') {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const entries = JSON.parse(storage)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for (const [key, value] of Object.entries(entries)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      window.sessionStorage.setItem(key, key)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  }
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 16:51:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								})('""" + session_storage + "')")
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 09:34:49 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```python sync
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import os
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Get session storage and store as env variable
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								session_storage = page.evaluate("() => JSON.stringify(sessionStorage)")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								os.environ["SESSION_STORAGE"] = session_storage
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Set session storage in a new context
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								session_storage = os.environ["SESSION_STORAGE"]
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 16:51:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								context.add_init_script("""(storage => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if (window.location.hostname === 'example.com') {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const entries = JSON.parse(storage)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for (const [key, value] of Object.entries(entries)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      window.sessionStorage.setItem(key, key)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  }
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 16:51:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								})('""" + session_storage + "')")
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 04:49:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```csharp
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Get session storage and store as env variable
							 
						 
					
						
							
								
									
										
										
										
											2022-01-27 22:07:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								var sessionStorage = await page.EvaluateAsync< string > ("() => JSON.stringify(sessionStorage)");
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 04:49:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Environment.SetEnvironmentVariable("SESSION_STORAGE", sessionStorage);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Set session storage in a new context
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								var loadedSessionStorage = Environment.GetEnvironmentVariable("SESSION_STORAGE");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								await context.AddInitScriptAsync(@"(storage => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if (window.location.hostname === 'example.com') {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      const entries = JSON.parse(storage);
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 16:51:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      for (const [key, value] of Object.entries(entries)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        window.sessionStorage.setItem(key, value);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 04:49:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 16:51:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  })('" + loadedSessionStorage + "')");
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 04:49:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								### API reference
  
						 
					
						
							
								
									
										
										
										
											2021-01-08 12:24:10 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [`method: BrowserContext.storageState` ] 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [`method: Browser.newContext` ] 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								-  [`method: Page.evaluate` ] 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [`method: BrowserContext.addInitScript` ] 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Multi-factor authentication
  
						 
					
						
							
								
									
										
										
										
											2021-01-20 08:12:39 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Accounts with multi-factor authentication (MFA) cannot be fully automated, and need
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								manual intervention. Persistent authentication can be used to partially automate
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								MFA scenarios.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Persistent authentication
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Note that persistent authentication is not suited for CI environments since it
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								relies on a disk location. User data directories are specific to browser types
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								and cannot be shared across browser types.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 11:59:29 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								User data directories can be used with the [`method: BrowserType.launchPersistentContext` ] API.
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const { chromium } = require('playwright');
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const userDataDir = '/path/to/directory';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const context = await chromium.launchPersistentContext(userDataDir, { headless: false });
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Execute login steps manually in the browser window
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```java
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import com.microsoft.playwright.*;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public class Example {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  public static void main(String[] args) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    try (Playwright playwright = Playwright.create()) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      BrowserType chromium = playwright.chromium();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      Path userDataDir = Paths.get("/path/to/directory");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      BrowserContext context = chromium.launchPersistentContext(userDataDir,
							 
						 
					
						
							
								
									
										
										
										
											2021-03-05 13:50:34 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        new BrowserType.LaunchPersistentContextOptions().setHeadless(false));
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 09:18:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      // Execute login steps manually in the browser window
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 09:34:49 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```python async
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import asyncio
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 17:04:24 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								from playwright.async_api import async_playwright
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								async def main():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    async with async_playwright() as p:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        user_data_dir = '/path/to/directory'
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 15:07:43 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        browser = await p.chromium.launch_persistent_context(user_data_dir, headless=False)
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        # Execute login steps manually in the browser window
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-15 09:12:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								asyncio.run(main())
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 09:34:49 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```python sync
							 
						 
					
						
							
								
									
										
										
										
											2021-01-11 17:04:24 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								from playwright.sync_api import sync_playwright
							 
						 
					
						
							
								
									
										
										
										
											2021-01-08 17:39:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								with sync_playwright() as p:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    user_data_dir = '/path/to/directory'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    browser = p.chromium.launch_persistent_context(user_data_dir, headless=False)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # Execute login steps manually in the browser window
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 04:49:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```csharp
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using Microsoft.Playwright;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-22 07:55:53 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class Program
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 04:49:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{
							 
						 
					
						
							
								
									
										
										
										
											2021-05-22 07:55:53 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    public static async Task Main()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        using var playwright = await Playwright.CreateAsync();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var chromium = playwright.Chromium;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var context = chromium.LaunchPersistentContextAsync(@"C:\path\to\directory\", new BrowserTypeLaunchPersistentContextOptions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            Headless = false
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        });
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2021-05-20 04:49:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								### Lifecycle
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-28 11:06:41 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								1.  Create a user data directory on disk. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Launch a persistent context with the user data directory and login the MFA account. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Reuse user data directory to run automation scenarios. 
						 
					
						
							
								
									
										
										
										
											2020-12-30 18:04:51 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### API reference
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [BrowserContext] 
						 
					
						
							
								
									
										
										
										
											2021-05-20 04:49:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [`method: BrowserType.launchPersistentContext` ]