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


Java Cookie.isSecure方法代碼示例

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


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

示例1: getCookies

import org.openqa.selenium.Cookie; //導入方法依賴的package包/類
/**
 * Get all the cookies for the current domain. This is the equivalent of calling "document.cookie" and parsing the result
 *
 * @return {@link com.axway.ats.uiengine.elements.html.Cookie Cookie}s array
 */
@PublicAtsApi
public com.axway.ats.uiengine.elements.html.Cookie[] getCookies() {

    Set<Cookie> cookies = webDriver.manage().getCookies();
    com.axway.ats.uiengine.elements.html.Cookie[] cookiesArr = new com.axway.ats.uiengine.elements.html.Cookie[cookies.size()];
    int i = 0;
    for (Cookie c : cookies) {
        cookiesArr[i++] = new com.axway.ats.uiengine.elements.html.Cookie(c.getName(),
                                                                          c.getValue(),
                                                                          c.getDomain(),
                                                                          c.getPath(),
                                                                          c.getExpiry(),
                                                                          c.isSecure());
    }
    return cookiesArr;
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:22,代碼來源:AbstractHtmlEngine.java

示例2: writeFile

import org.openqa.selenium.Cookie; //導入方法依賴的package包/類
public static void writeFile(String fileName, Set<Cookie> cookies) {
    try {
        File file = new File(fileName);
        FileWriter fileWriter = new FileWriter(file);
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
        for (Cookie cookie : cookies) {
            String strCookie = cookie.getName() + ";" + cookie.getValue() + ";" + cookie.getDomain() + ";"
                    + cookie.getPath() + ";" + cookie.getExpiry() + ";" + cookie.isSecure() + ";"
                    + cookie.isHttpOnly();
            bufferedWriter.write(strCookie);
            bufferedWriter.newLine();
        }
        bufferedWriter.flush();
        bufferedWriter.close();
        fileWriter.close();
        LogUtils.info("寫文件[" + fileName + "]操作成功");
    } catch (Exception e) {
        LogUtils.error("寫文件[" + fileName + "]操作失敗: " + e.getMessage());
        e.printStackTrace();
    }
}
 
開發者ID:Airpy,項目名稱:KeywordDrivenAutoTest,代碼行數:22,代碼來源:FileUtils.java

示例3: writeCookieToFile

import org.openqa.selenium.Cookie; //導入方法依賴的package包/類
/**
 * 把cookie追加寫入cookie文件
 *
 * @param isDeleteFirst 是否先刪除cookie文件
 */
public static void writeCookieToFile(Cookie cookie, boolean isDeleteFirst) {
    String strCookie = cookie.getName() + ";" + cookie.getValue() + ";" + cookie.getDomain() + ";"
            + cookie.getPath() + ";" + cookie.getExpiry() + ";" + cookie.isSecure() + ";" + cookie.isHttpOnly();
    if (isDeleteFirst) {
        FileUtils.deleteFile(cookiePath);
        FileUtils.createFile(cookiePath);
    }
    FileUtils.writeFile(cookiePath, strCookie);
}
 
開發者ID:Airpy,項目名稱:KeywordDrivenAutoTest,代碼行數:15,代碼來源:WebCookies.java


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