當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Options.addCookie方法代碼示例

本文整理匯總了TypeScript中selenium-webdriver.Options.addCookie方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Options.addCookie方法的具體用法?TypeScript Options.addCookie怎麽用?TypeScript Options.addCookie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在selenium-webdriver.Options的用法示例。


在下文中一共展示了Options.addCookie方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: TestWebDriverOptions

function TestWebDriverOptions() {
    let driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    let options: webdriver.Options = new webdriver.Options(driver);
    let promise: webdriver.promise.Promise<void>;

    let name: string = 'name';
    let value: string = 'value';
    let path: string = 'path';
    let domain: string = 'domain';
    let secure: boolean = true;
    let httpOnly: boolean = true;

    // Add Cookie
    promise = options.addCookie({ name, value });
    promise = options.addCookie({ name, value, path });
    promise = options.addCookie({ name, value, path, domain });
    promise = options.addCookie({ name, value, path, domain, secure });
    promise = options.addCookie({ name, value, path, domain, secure, httpOnly });
    promise = options.addCookie({ name, value, path, domain, secure, httpOnly, expiry: 123 });
    promise = options.addCookie({ name, value, path, domain, secure, httpOnly, expiry: Date.now() });

    promise = options.deleteAllCookies();
    promise = options.deleteCookie('name');
    options.getCookie('name').then((cookie: webdriver.IWebDriverCookie) => {
        let expiry: number | undefined = cookie.expiry;
     });
    options.getCookies().then((cookies: webdriver.IWebDriverCookie[]) => { });

    let logs: webdriver.Logs = options.logs();
    let timeouts: webdriver.Timeouts = options.timeouts();
    let window: webdriver.Window = options.window();
}
開發者ID:Rick-Kirkham,項目名稱:DefinitelyTyped,代碼行數:35,代碼來源:index.ts

示例2: TestWebDriverOptions

function TestWebDriverOptions() {
    var driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    var options: webdriver.Options = new webdriver.Options(driver);
    var promise: webdriver.promise.Promise<void>;

    // Add Cookie
    promise = options.addCookie('name', 'value');
    promise = options.addCookie('name', 'value', 'path');
    promise = options.addCookie('name', 'value', 'path', 'domain');
    promise = options.addCookie('name', 'value', 'path', 'domain', true);
    promise = options.addCookie('name', 'value', 'path', 'domain', true, 123);
    promise = options.addCookie('name', 'value', 'path', 'domain', true, Date.now());

    promise = options.deleteAllCookies();
    promise = options.deleteCookie('name');
    options.getCookie('name').then(function (cookies: webdriver.IWebDriverOptionsCookie) { });
    options.getCookies().then(function (cookies: webdriver.IWebDriverOptionsCookie[]) { });

    var logs: webdriver.Logs = options.logs();
    var timeouts: webdriver.Timeouts = options.timeouts();
    var window: webdriver.Window = options.window();
}
開發者ID:ArtemZag,項目名稱:DefinitelyTyped,代碼行數:25,代碼來源:index.ts


注:本文中的selenium-webdriver.Options.addCookie方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。