测试人社区

Appium-get-all-cookies

Get All Cookies

Retrieve all cookies visible to the current page (Web context only)
//: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/web/storage/get-all-cookies.yml)

Example Usage

// Java
Set<Cookie> allcookies = driver.manage().getCookies();

# Python
cookies = self.driver.get_cookies()

// Javascript
// webdriver.io example
let cookies = driver.getCookies():

// wd example
let cookies = await driver.allCookies();

# Ruby
# ruby_lib example
manage.all_cookies

# ruby_lib_core example
@driver.manage.all_cookies

# PHP
// TODO PHP sample

// C#
IEnumerable<Cookie> allCookies = driver.Manage().Cookies.AllCookies;

Support

Appium Server

Platform Driver Platform Versions Appium Version Driver Version
iOS XCUITest None None None
UIAutomation None None None
Android UiAutomator2 None None None
Espresso None None None
UiAutomator None None None
Mac Mac None None None
Windows Windows None None None

Appium Clients

HTTP API Specifications

Endpoint

GET /session/:sessionId/cookie

URL Parameters

name description
session_id ID of the session to route the command to

JSON Parameters

None

Response

A list of cookies (array<object>)

See Also

官方链接为:http://appium.io/docs/en/commands/web/storage/get-all-cookies