How to use createJSCookie method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

79ff32c7aa64ba30c84884c1d25e88b1.js

Source:79ff32c7aa64ba30c84884c1d25e88b1.js Github

copy

Full Screen

...1749 }1750 Nitro.handleClientLogAction = function() { 1751 1752 //save the cookie that we have logged the action1753 NitroCookies.createJSCookie('NITRO_ACTION-'+Nitro.redirectToAction+"|"+Nitro.redirectToUserId, true, 365);1754 1755 if(Nitro.redirectTo) {1756 window.location = decodeURI(Nitro.redirectTo);1757 }1758 }1759 1760 this.getUrlParameter = function(name) {1761 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");1762 var regexS = "[\\?&]"+name+"=([^&#]*)";1763 var regex = new RegExp( regexS );1764 var results = regex.exec(window.location.href);1765 if(results == null)1766 return null;1767 else1768 return results[1];1769 }1770 }1771 1772 /**** Localization *****1773 * This variable will be populated after Login takes place and a locale is requested1774 */1775 Nitro.Localization = null;1776 1777 Nitro.getLocale = function() {1778 if ( navigator ) {1779 if ( navigator.language ) {1780 return navigator.language;1781 } else if ( navigator.browserLanguage ) {1782 return navigator.browserLanguage;1783 } else if ( navigator.systemLanguage ) {1784 return navigator.systemLanguage;1785 } else if ( navigator.userLanguage ) {1786 return navigator.userLanguage;1787 }1788 }1789 }1790 Nitro.getLocalizationFile = function(locale) {1791 if(typeof JSONscriptRequest == "undefined") {1792 eval('setTimeout("Nitro.getLocalizationFile(\''+locale+'\')",50)');1793 return;1794 }1795 var fullUrl = nitroProtocol+"://assets.bunchball.net/scripts/locale/"+nitroLibsVersion+"/"+locale+".properties";1796 var obj=new JSONscriptRequest(fullUrl,true); 1797 obj.buildScriptTag(); // Build the script tag 1798 obj.addScriptTag(); // Execute (add) the script tag1799 }1800 1801 Nitro.processLocalizationFile = function(data) {1802 1803 if(!Nitro.Localization)1804 Nitro.Localization = [];1805 1806 var localeMap = eval(data);1807 for (var name in localeMap) {1808 var value = localeMap[name];1809 Nitro.Localization[name] = value;1810 }1811 } 1812 1813 //for flash ease of use1814 Nitro.getLocalizedString = function(name,prefix) {1815 return name.nitroLocalize(prefix);1816 }1817 1818 String.prototype.nitroLocalize = function(prefix){1819 if(!prefix)1820 var prefix = 'javascript';1821 1822 var s = Nitro.Localization[prefix+"."+this];1823 if( !s ) return( "���" + this + "���" );1824 for (var i = 1; i < arguments.length; i++) {1825 s = s.replace("{" + i + "}", arguments[i]);1826 } 1827 return s;1828 };1829 1830 if(typeof nitroLocale != "undefined")1831 Nitro.getLocalizationFile(nitroLocale);1832}1833;1834/*1835 * Copyright (C) 1999-2015 Jive Software. All rights reserved.1836 *1837 * This software is the proprietary information of Jive Software. Use is subject to license terms.1838 */1839var nitroProtocol = "http";1840if( document.location.toString().indexOf( 'https://' ) != -1 ) {1841 nitroProtocol = "https";1842}1843if (typeof nitroLibsVersion == "undefined") {1844 nitroLibsVersion = "current"; 1845} 1846if (typeof NitroCookies=="undefined") {1847 NitroCookies = {};1848 NitroCookies.swfLoaded = false;1849 NitroCookies.callbacks = [];1850 NitroCookies.setIds = []; 1851 1852 NitroCookies.getUserId = function (apiKey, callback) {1853 var key = "NITRO_USERID_" + apiKey;1854 1855 var value = "alpha";1856 1857 1858 if (typeof callback != "undefined" && callback != null) {1859 // we got it from the browser or from the SWF, call callback and return. 1860 callback(value); 1861 return value;1862 }1863 1864 // Return with no value. 1865 return;1866 }1867 1868 // unused arguments are to maintain backward compatibility for now. 1869 // change in nitro.js to remove. 1870 NitroCookies.setUserId = function(apiKey, value, unused1, unused2) {1871 var key = "NITRO_USERID_" + apiKey; 1872 return;1873}1874 1875 1876 NitroCookies.isSetup = false;1877 NitroCookies.setup = function() {1878 if(NitroCookies.isSetup) {1879 return;1880 }1881 NitroCookies.isSetup = true;1882 1883 } 1884 NitroCookies.getSWFUserId = function(key) { 1885 return "alpha";1886 }1887 1888 NitroCookies.setSWFUserId = function(key, value) {1889 return;1890 } 1891 1892 1893 NitroCookies.createJSCookie = function(name,value,days) {1894 if (days) {1895 var date = new Date();1896 date.setTime(date.getTime()+(days*24*60*60*1000));1897 var expires = "; expires="+date.toGMTString();1898 }1899 else var expires = "";1900 document.cookie = name+"="+value+expires+"; path=/";1901 }1902 NitroCookies.readJSCookie = function(name) {1903 var nameEQ = name + "=";1904 var ca = document.cookie.split(';');1905 for(var i=0;i < ca.length;i++) {1906 var c = ca[i];1907 while (c.charAt(0)==' ') c = c.substring(1,c.length);1908 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);1909 }1910 return null;1911 }1912 1913 NitroCookies.setup(); 1914}1915;1916/*1917 * Copyright (C) 1999-2015 Jive Software. All rights reserved.1918 *1919 * This software is the proprietary information of Jive Software. Use is subject to license terms.1920 */1921var nitroProtocol = "http";1922if( document.location.toString().indexOf( 'https://' ) != -1 ) {1923 nitroProtocol = "https";1924}1925if (typeof nitroLibsVersion == "undefined") {1926 nitroLibsVersion = "current"; 1927} 1928if (typeof NitroJSConnector=="undefined") {1929 1930 function NitroJSConnector(connectionParams) {1931 this.connectionParams = connectionParams;1932 if (typeof NitroJSConnector.counter == "undefined") {1933 NitroJSConnector.counter = 0;1934 }1935 this.counterId = NitroJSConnector.counter ++;1936 if(typeof this.connectionParams.autoLogin == "undefined") {1937 this.connectionParams.autoLogin = true;1938 }1939 1940 this.tryLogin = function() {1941 if (this.connectionParams.userId == null) {1942 if (typeof NitroCookies != "undefined") {1943 // wait for callback before proceeding. 1944 NitroCookies.getUserId(this.connectionParams.apiKey, NitroJSConnector.gotUserId);1945 return;1946 }1947 }1948 1949 if(!this.connectionParams.autoLogin && this.connectionParams.userId.indexOf('NITRO_USER_') == 0) {1950 NitroCookies.createJSCookie("anonymous",true,365);1951 this.connectionParams.userId = null;1952 }1953 1954 // If we have the session key stored in a cookie, use it. Otherwise, we need to login.1955 if (NitroCookies.readJSCookie("NITRO_SESSION_" + this.connectionParams.apiKey + "_" + this.connectionParams.userId)) {1956 this.connectionParams.sessionKey = NitroCookies.readJSCookie("NITRO_SESSION_" + this.connectionParams.apiKey + "_" + this.connectionParams.userId);1957 this.connectionParams.abTestGroup = NitroCookies.readJSCookie("NITRO_AB_" + this.connectionParams.apiKey + "_" + this.connectionParams.userId);1958 }1959 else if (this.connectionParams.autoLogin && this.connectionParams.anonymous) { //creates a new random user1960 NitroCookies.createJSCookie("anonymous",true,365);//explicit anonymous call1961 this.callAPI("method=user.anonymousLogin&apiKey=" + this.connectionParams.apiKey, "NitroJSConnector.processLogin", this.counterId, false, true);1962 } else if (this.connectionParams.autoLogin && typeof this.connectionParams.timeStamp == "undefined") { //low security1963 this.callAPI("method=user.login&apiKey=" + this.connectionParams.apiKey, "NitroJSConnector.processLogin", this.counterId, true, true);1964 } else if(this.connectionParams.userId) { //medium+ security1965 //we were given a userId1966 NitroCookies.createJSCookie("anonymous",false,365);1967 this.callAPI("method=user.login&apiKey=" + this.connectionParams.apiKey + 1968 "&ts=" + this.connectionParams.timeStamp + "&sig=" + this.connectionParams.signature, 1969 "NitroJSConnector.processLogin", this.counterId, true, true);1970 }1971 else {1972 this.connectionParams.noLogin = true;1973 1974 if (NitroJSConnector.toolbarArgs) {1975 nitroToolbar.show(NitroJSConnector.toolbarArgs);1976 NitroJSConnector.toolbarArgs = null;1977 }1978 }1979 }1980 1981 NitroJSConnector.gotUserId = function(userId) {1982 NitroJSConnector.userId = userId;1983 for (var i = 0; i < NitroJSConnector.instances.length; i++) {1984 NitroJSConnector.instances[i].connectionParams.userId = userId;1985 if(userId.indexOf('NITRO_USER_') == 0) {1986 //we were not given a user id and we created one ourselves1987 NitroCookies.createJSCookie("anonymous",true,365);1988 }1989 NitroJSConnector.instances[i].tryLogin();1990 }1991 1992 }1993 1994 this.callAPI = function (params, callback, asyncToken, addUserId, noSessionKey) {1995 var fullUrl = this.connectionParams.server + "?" + params;1996 if (callback != null) {1997 fullUrl = fullUrl + "&jsCallback=" + callback; 1998 }1999 if (asyncToken != null) {2000 fullUrl = fullUrl + "&jsAsyncToken=" + asyncToken; 2001 }2002 if (this.connectionParams.userId && addUserId != null && addUserId == true) {2003 fullUrl = fullUrl + "&userId=" + this.connectionParams.userId; 2004 }2005 2006 if (noSessionKey == null || noSessionKey == false) {2007 if (this.connectionParams.sessionKey == null) {2008 if (this.retryTries > 0) {2009 this.retryTries--;2010 var _self = this;2011 setTimeout(function(){2012 _self.callAPI(params, callback, asyncToken, addUserId, noSessionKey);2013 }, this.retryCallInterval);2014 }2015 return; 2016 }2017 2018 fullUrl = fullUrl + "&sessionKey=" + this.connectionParams.sessionKey;2019 }else {2020 fullUrl = fullUrl + "&apiKey=" + this.connectionParams.apiKey; 2021 }2022 2023 if (this.connectionParams.abTestGroup == "no") {2024 // don't make any nitro calls for the "no" group2025 return;2026 }2027 setTimeout(function(){2028 var obj=new JSONscriptRequest(fullUrl);2029 obj.buildScriptTag(); // Build the script tag2030 obj.addScriptTag(); // Execute (add) the script tag2031 }, _jive_nitro_call_delay)2032 }2033 2034 NitroJSConnector.processLogin = function(data,token) {2035 if (data == null) {2036 if (NitroJSConnector.debug) {2037 alert ('Error');2038 }2039 return;2040 }2041 if (data.Nitro.res == "err") {2042 if (NitroJSConnector.debug) {2043 alert (data.Nitro.Error.Message);2044 }2045 return;2046 }2047 2048 for (var i = 0; i < NitroJSConnector.instances.length; i++) {2049 if (NitroJSConnector.instances[i].counterId == token) {2050 var cp = NitroJSConnector.instances[i].connectionParams;2051 2052 if(data.Nitro.Login.userId)2053 cp.userId = data.Nitro.Login.userId;2054 2055 cp.sessionKey = data.Nitro.Login.sessionKey;2056 NitroCookies.createJSCookie("NITRO_SESSION_" + cp.apiKey + "_" + cp.userId, data.Nitro.Login.sessionKey, 1/72);2057 2058 if (typeof data.Nitro.Login.TestGroup != "undefined") {2059 cp.abTestGroup = data.Nitro.Login.TestGroup.abTestGroup;2060 NitroCookies.createJSCookie("NITRO_AB_" + cp.apiKey + "_" + cp.userId, data.Nitro.Login.TestGroup.abTestGroup, 1/72);2061 }2062 else {2063 cp.abTestGroup = null;2064 }2065 2066 break;2067 }2068 }2069 2070 if (NitroJSConnector.toolbarArgs) {2071 nitroToolbar.show(NitroJSConnector.toolbarArgs);2072 NitroJSConnector.toolbarArgs = null;2073 }2074 }...

Full Screen

Full Screen

db20bd5c00d595a481b92c9f421f91f4.js

Source:db20bd5c00d595a481b92c9f421f91f4.js Github

copy

Full Screen

...1749 }1750 Nitro.handleClientLogAction = function() { 1751 1752 //save the cookie that we have logged the action1753 NitroCookies.createJSCookie('NITRO_ACTION-'+Nitro.redirectToAction+"|"+Nitro.redirectToUserId, true, 365);1754 1755 if(Nitro.redirectTo) {1756 window.location = decodeURI(Nitro.redirectTo);1757 }1758 }1759 1760 this.getUrlParameter = function(name) {1761 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");1762 var regexS = "[\\?&]"+name+"=([^&#]*)";1763 var regex = new RegExp( regexS );1764 var results = regex.exec(window.location.href);1765 if(results == null)1766 return null;1767 else1768 return results[1];1769 }1770 }1771 1772 /**** Localization *****1773 * This variable will be populated after Login takes place and a locale is requested1774 */1775 Nitro.Localization = null;1776 1777 Nitro.getLocale = function() {1778 if ( navigator ) {1779 if ( navigator.language ) {1780 return navigator.language;1781 } else if ( navigator.browserLanguage ) {1782 return navigator.browserLanguage;1783 } else if ( navigator.systemLanguage ) {1784 return navigator.systemLanguage;1785 } else if ( navigator.userLanguage ) {1786 return navigator.userLanguage;1787 }1788 }1789 }1790 Nitro.getLocalizationFile = function(locale) {1791 if(typeof JSONscriptRequest == "undefined") {1792 eval('setTimeout("Nitro.getLocalizationFile(\''+locale+'\')",50)');1793 return;1794 }1795 var fullUrl = nitroProtocol+"://assets.bunchball.net/scripts/locale/"+nitroLibsVersion+"/"+locale+".properties";1796 var obj=new JSONscriptRequest(fullUrl,true); 1797 obj.buildScriptTag(); // Build the script tag 1798 obj.addScriptTag(); // Execute (add) the script tag1799 }1800 1801 Nitro.processLocalizationFile = function(data) {1802 1803 if(!Nitro.Localization)1804 Nitro.Localization = [];1805 1806 var localeMap = eval(data);1807 for (var name in localeMap) {1808 var value = localeMap[name];1809 Nitro.Localization[name] = value;1810 }1811 } 1812 1813 //for flash ease of use1814 Nitro.getLocalizedString = function(name,prefix) {1815 return name.nitroLocalize(prefix);1816 }1817 1818 String.prototype.nitroLocalize = function(prefix){1819 if(!prefix)1820 var prefix = 'javascript';1821 1822 var s = Nitro.Localization[prefix+"."+this];1823 if( !s ) return( "���" + this + "���" );1824 for (var i = 1; i < arguments.length; i++) {1825 s = s.replace("{" + i + "}", arguments[i]);1826 } 1827 return s;1828 };1829 1830 if(typeof nitroLocale != "undefined")1831 Nitro.getLocalizationFile(nitroLocale);1832}1833;1834/*1835 * Copyright (C) 1999-2015 Jive Software. All rights reserved.1836 *1837 * This software is the proprietary information of Jive Software. Use is subject to license terms.1838 */1839var nitroProtocol = "http";1840if( document.location.toString().indexOf( 'https://' ) != -1 ) {1841 nitroProtocol = "https";1842}1843if (typeof nitroLibsVersion == "undefined") {1844 nitroLibsVersion = "current"; 1845} 1846if (typeof NitroCookies=="undefined") {1847 NitroCookies = {};1848 NitroCookies.swfLoaded = false;1849 NitroCookies.callbacks = [];1850 NitroCookies.setIds = []; 1851 1852 NitroCookies.getUserId = function (apiKey, callback) {1853 var key = "NITRO_USERID_" + apiKey;1854 1855 var value = "alpha";1856 1857 1858 if (typeof callback != "undefined" && callback != null) {1859 // we got it from the browser or from the SWF, call callback and return. 1860 callback(value); 1861 return value;1862 }1863 1864 // Return with no value. 1865 return;1866 }1867 1868 // unused arguments are to maintain backward compatibility for now. 1869 // change in nitro.js to remove. 1870 NitroCookies.setUserId = function(apiKey, value, unused1, unused2) {1871 var key = "NITRO_USERID_" + apiKey; 1872 return;1873}1874 1875 1876 NitroCookies.isSetup = false;1877 NitroCookies.setup = function() {1878 if(NitroCookies.isSetup) {1879 return;1880 }1881 NitroCookies.isSetup = true;1882 1883 } 1884 NitroCookies.getSWFUserId = function(key) { 1885 return "alpha";1886 }1887 1888 NitroCookies.setSWFUserId = function(key, value) {1889 return;1890 } 1891 1892 1893 NitroCookies.createJSCookie = function(name,value,days) {1894 if (days) {1895 var date = new Date();1896 date.setTime(date.getTime()+(days*24*60*60*1000));1897 var expires = "; expires="+date.toGMTString();1898 }1899 else var expires = "";1900 document.cookie = name+"="+value+expires+"; path=/";1901 }1902 NitroCookies.readJSCookie = function(name) {1903 var nameEQ = name + "=";1904 var ca = document.cookie.split(';');1905 for(var i=0;i < ca.length;i++) {1906 var c = ca[i];1907 while (c.charAt(0)==' ') c = c.substring(1,c.length);1908 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);1909 }1910 return null;1911 }1912 1913 NitroCookies.setup(); 1914}1915;1916/*1917 * Copyright (C) 1999-2015 Jive Software. All rights reserved.1918 *1919 * This software is the proprietary information of Jive Software. Use is subject to license terms.1920 */1921var nitroProtocol = "http";1922if( document.location.toString().indexOf( 'https://' ) != -1 ) {1923 nitroProtocol = "https";1924}1925if (typeof nitroLibsVersion == "undefined") {1926 nitroLibsVersion = "current"; 1927} 1928if (typeof NitroJSConnector=="undefined") {1929 1930 function NitroJSConnector(connectionParams) {1931 this.connectionParams = connectionParams;1932 if (typeof NitroJSConnector.counter == "undefined") {1933 NitroJSConnector.counter = 0;1934 }1935 this.counterId = NitroJSConnector.counter ++;1936 if(typeof this.connectionParams.autoLogin == "undefined") {1937 this.connectionParams.autoLogin = true;1938 }1939 1940 this.tryLogin = function() {1941 if (this.connectionParams.userId == null) {1942 if (typeof NitroCookies != "undefined") {1943 // wait for callback before proceeding. 1944 NitroCookies.getUserId(this.connectionParams.apiKey, NitroJSConnector.gotUserId);1945 return;1946 }1947 }1948 1949 if(!this.connectionParams.autoLogin && this.connectionParams.userId.indexOf('NITRO_USER_') == 0) {1950 NitroCookies.createJSCookie("anonymous",true,365);1951 this.connectionParams.userId = null;1952 }1953 1954 // If we have the session key stored in a cookie, use it. Otherwise, we need to login.1955 if (NitroCookies.readJSCookie("NITRO_SESSION_" + this.connectionParams.apiKey + "_" + this.connectionParams.userId)) {1956 this.connectionParams.sessionKey = NitroCookies.readJSCookie("NITRO_SESSION_" + this.connectionParams.apiKey + "_" + this.connectionParams.userId);1957 this.connectionParams.abTestGroup = NitroCookies.readJSCookie("NITRO_AB_" + this.connectionParams.apiKey + "_" + this.connectionParams.userId);1958 }1959 else if (this.connectionParams.autoLogin && this.connectionParams.anonymous) { //creates a new random user1960 NitroCookies.createJSCookie("anonymous",true,365);//explicit anonymous call1961 this.callAPI("method=user.anonymousLogin&apiKey=" + this.connectionParams.apiKey, "NitroJSConnector.processLogin", this.counterId, false, true);1962 } else if (this.connectionParams.autoLogin && typeof this.connectionParams.timeStamp == "undefined") { //low security1963 this.callAPI("method=user.login&apiKey=" + this.connectionParams.apiKey, "NitroJSConnector.processLogin", this.counterId, true, true);1964 } else if(this.connectionParams.userId) { //medium+ security1965 //we were given a userId1966 NitroCookies.createJSCookie("anonymous",false,365);1967 this.callAPI("method=user.login&apiKey=" + this.connectionParams.apiKey + 1968 "&ts=" + this.connectionParams.timeStamp + "&sig=" + this.connectionParams.signature, 1969 "NitroJSConnector.processLogin", this.counterId, true, true);1970 }1971 else {1972 this.connectionParams.noLogin = true;1973 1974 if (NitroJSConnector.toolbarArgs) {1975 nitroToolbar.show(NitroJSConnector.toolbarArgs);1976 NitroJSConnector.toolbarArgs = null;1977 }1978 }1979 }1980 1981 NitroJSConnector.gotUserId = function(userId) {1982 NitroJSConnector.userId = userId;1983 for (var i = 0; i < NitroJSConnector.instances.length; i++) {1984 NitroJSConnector.instances[i].connectionParams.userId = userId;1985 if(userId.indexOf('NITRO_USER_') == 0) {1986 //we were not given a user id and we created one ourselves1987 NitroCookies.createJSCookie("anonymous",true,365);1988 }1989 NitroJSConnector.instances[i].tryLogin();1990 }1991 1992 }1993 1994 this.callAPI = function (params, callback, asyncToken, addUserId, noSessionKey) {1995 var fullUrl = this.connectionParams.server + "?" + params;1996 if (callback != null) {1997 fullUrl = fullUrl + "&jsCallback=" + callback; 1998 }1999 if (asyncToken != null) {2000 fullUrl = fullUrl + "&jsAsyncToken=" + asyncToken; 2001 }2002 if (this.connectionParams.userId && addUserId != null && addUserId == true) {2003 fullUrl = fullUrl + "&userId=" + this.connectionParams.userId; 2004 }2005 2006 if (noSessionKey == null || noSessionKey == false) {2007 if (this.connectionParams.sessionKey == null) {2008 if (this.retryTries > 0) {2009 this.retryTries--;2010 var _self = this;2011 setTimeout(function(){2012 _self.callAPI(params, callback, asyncToken, addUserId, noSessionKey);2013 }, this.retryCallInterval);2014 }2015 return; 2016 }2017 2018 fullUrl = fullUrl + "&sessionKey=" + this.connectionParams.sessionKey;2019 }else {2020 fullUrl = fullUrl + "&apiKey=" + this.connectionParams.apiKey; 2021 }2022 2023 if (this.connectionParams.abTestGroup == "no") {2024 // don't make any nitro calls for the "no" group2025 return;2026 }2027 setTimeout(function(){2028 var obj=new JSONscriptRequest(fullUrl);2029 obj.buildScriptTag(); // Build the script tag2030 obj.addScriptTag(); // Execute (add) the script tag2031 }, _jive_nitro_call_delay)2032 }2033 2034 NitroJSConnector.processLogin = function(data,token) {2035 if (data == null) {2036 if (NitroJSConnector.debug) {2037 alert ('Error');2038 }2039 return;2040 }2041 if (data.Nitro.res == "err") {2042 if (NitroJSConnector.debug) {2043 alert (data.Nitro.Error.Message);2044 }2045 return;2046 }2047 2048 for (var i = 0; i < NitroJSConnector.instances.length; i++) {2049 if (NitroJSConnector.instances[i].counterId == token) {2050 var cp = NitroJSConnector.instances[i].connectionParams;2051 2052 if(data.Nitro.Login.userId)2053 cp.userId = data.Nitro.Login.userId;2054 2055 cp.sessionKey = data.Nitro.Login.sessionKey;2056 NitroCookies.createJSCookie("NITRO_SESSION_" + cp.apiKey + "_" + cp.userId, data.Nitro.Login.sessionKey, 1/72);2057 2058 if (typeof data.Nitro.Login.TestGroup != "undefined") {2059 cp.abTestGroup = data.Nitro.Login.TestGroup.abTestGroup;2060 NitroCookies.createJSCookie("NITRO_AB_" + cp.apiKey + "_" + cp.userId, data.Nitro.Login.TestGroup.abTestGroup, 1/72);2061 }2062 else {2063 cp.abTestGroup = null;2064 }2065 2066 break;2067 }2068 }2069 2070 if (NitroJSConnector.toolbarArgs) {2071 nitroToolbar.show(NitroJSConnector.toolbarArgs);2072 NitroJSConnector.toolbarArgs = null;2073 }2074 }...

Full Screen

Full Screen

web.js

Source:web.js Github

copy

Full Screen

...100 // if `path` field is not specified, Safari will not update cookies as expected; eg issue #1708101 if (!cookie.path) {102 cookie.path = "/";103 }104 let jsCookie = cookieUtils.createJSCookie(cookie.name, cookie.value, {105 expires: _.isNumber(cookie.expiry) ? (new Date(cookie.expiry * 1000)).toUTCString() :106 cookie.expiry,107 path: cookie.path,108 domain: cookie.domain,109 httpOnly: cookie.httpOnly,110 secure: cookie.secure111 });112 let script = `document.cookie = ${JSON.stringify(jsCookie)}`;113 await this.executeAtom('execute_script', [script, []]);114};115commands.deleteCookie = async function (cookieName) {116 if (!this.isWebContext()) {117 throw new errors.NotImplementedError();118 }...

Full Screen

Full Screen

cookies-specs.js

Source:cookies-specs.js Github

copy

Full Screen

...5chai.expect();6let expect = chai.expect;7describe ('cookies.js', function () {8 it('should properly create a JS cookie', function () {9 let jsCookie = cookies.createJSCookie('k', 'v');10 jsCookie.should.equal('k=v');11 });12 it('should create JS cookie with options given', function () {13 let jsCookie = cookies.createJSCookie('k', 'v', {expires: 'Thu, 01 Jan 2070 3:4:7 GMT', path: '/lib'});14 jsCookie.should.equal('k=v; expires=Thu, 01 Jan 2070 3:4:7 GMT; path=/lib');15 });16 it('should create JSON cookie object with options given', function () {17 let jsCookie = cookies.createJWPCookie('k', 'k=v; expires=Thu, 01 Jan 2070 3:4:7 GMT; path=/lib');18 expect(jsCookie).to.deep.equal({name: 'k', value: 'v', expires: 'Thu, 01 Jan 2070 3:4:7 GMT', path: '/lib'});19 });20 it('should return correct value given key', function () {21 let value = cookies.getValue('k', 'k=v; expires=Thu, 01 Jan 2070 3:4:7 GMT; path=/lib');22 value.should.equal('v');23 });24 it('should parse each element of string into an object', function () {25 let value = cookies.getValue(undefined, 'k=v; expires=Thu, 01 Jan 2070 3:4:7 GMT; path=/lib');26 value.should.eql({k: 'v', expires: 'Thu, 01 Jan 2070 3:4:7 GMT', path: '/lib'});27 });...

Full Screen

Full Screen

cookies.js

Source:cookies.js Github

copy

Full Screen

...70// returns a cookie that expires on 01 Jan 197071// assign the returned cookie to an existing cookie to delete that cookie72function expireCookie (key, options) {73 // override `expires` in `options`, and then make the cookie74 return createJSCookie(key, '', _.assign({}, options, {75 expires: 'Thu, 01 Jan 1970 00:00:00 GMT'76 }));77}78// export individually and also (as default) as an object79export { createJSCookie, createJWPCookie, getValue, expireCookie };...

Full Screen

Full Screen

cookie-specs.js

Source:cookie-specs.js Github

copy

Full Screen

...5chai.expect();6let expect = chai.expect;7describe ('cookies.js', () => {8 it('should properly create a JS cookie', () => {9 let jsCookie = cookie.createJSCookie('k', 'v');10 jsCookie.should.equal('k=v');11 });12 it('should create JS cookie with options given', () => {13 let jsCookie = cookie.createJSCookie('k', 'v', {expires: 'Thu, 01 Jan 2070 3:4:7 GMT', path: '/lib'});14 jsCookie.should.equal('k=v; expires=Thu, 01 Jan 2070 3:4:7 GMT; path=/lib');15 });16 it('should create JSON cookie object with options given', () => {17 let jsCookie = cookie.createJWPCookie('k', 'k=v; expires=Thu, 01 Jan 2070 3:4:7 GMT; path=/lib');18 expect(jsCookie).to.deep.equal({name: 'k', value: 'v', expires: 'Thu, 01 Jan 2070 3:4:7 GMT', path: '/lib'});19 });20 it('should return correct value given key', () => {21 let value = cookie.getValue('k', 'k=v; expires=Thu, 01 Jan 2070 3:4:7 GMT; path=/lib');22 value.should.equal('v');23 });24 it('should parse each element of string into an object', () => {25 let value = cookie.getValue(undefined, 'k=v; expires=Thu, 01 Jan 2070 3:4:7 GMT; path=/lib');26 value.should.eql({k: 'v', expires: 'Thu, 01 Jan 2070 3:4:7 GMT', path: '/lib'});27 });...

Full Screen

Full Screen

cookie.js

Source:cookie.js Github

copy

Full Screen

...62// returns a cookie that expires on 01 Jan 197063// assign the returned cookie to an existing cookie to delete that cookie64function expireCookie (key, options) {65 // override `expires` in `options`, and then make the cookie66 return createJSCookie(key, '', _.assign({}, options, {67 expires: 'Thu, 01 Jan 1970 00:00:00 GMT'68 }));69}...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1// transpile:main2import { createJSCookie, createJWPCookie, getValue, expireCookie } from './lib/cookie.js';...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.createJSCookie("cookieName", "cookieValue", "cookieDomain", "cookiePath", null, null);2driver.deleteJSCookie("cookieName");3driver.deleteAllJSCookies();4driver.getJSCookies();5driver.getJSCookieByName("cookieName");6driver.getNetworkConnection();7driver.setNetworkConnection(1);8driver.getPerformanceData("com.apple.mobilesafari", "cpuinfo", 1000);9driver.getPerformanceDataTypes();10driver.getPerformanceDataSize("com.apple.mobilesafari", "cpuinfo", 1000);11driver.getPerformanceDataTypes();12driver.getPerformanceDataSize("com.apple.mobilesafari", "cpuinfo", 1000);13driver.startRecordingScreen();14driver.stopRecordingScreen();15driver.getSettings();16driver.updateSettings("settings");17driver.getOrientation();18driver.setOrientation("orientation");19driver.getGeoLocation();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { createJSCookie } = require('appium-xcuitest-driver');2const cookie = createJSCookie('name', 'value', 'domain', 'path', 1234, false, false);3console.log(cookie);4const { createJSCookie } = require('appium-xcuitest-driver');5const cookie = createJSCookie('name', 'value', 'domain', 'path', 1234, false, false);6console.log(cookie);7const { createJSCookie } = require('appium-xcuitest-driver');8const cookie = createJSCookie('name', 'value', 'domain', 'path', 1234, false, false);9console.log(cookie);10const { createJSCookie } = require('appium-xcuitest-driver');11const cookie = createJSCookie('name', 'value', 'domain', 'path', 1234, false, false);12console.log(cookie);13const { createJSCookie } = require('appium-xcuitest-driver');14const cookie = createJSCookie('name', 'value', 'domain', 'path', 1234, false, false);15console.log(cookie);16const { createJSCookie } = require('appium-xcuitest-driver');17const cookie = createJSCookie('name', 'value', 'domain', 'path', 1234, false, false);18console.log(cookie);19const { createJSCookie } = require('appium-xcuitest-driver');20const cookie = createJSCookie('name', 'value', 'domain', 'path', 1234, false, false);21console.log(cookie);22const { createJSCookie } = require('appium-xcuitest-driver');23const cookie = createJSCookie('name', '

Full Screen

Using AI Code Generation

copy

Full Screen

1var createJSCookie = require('appium-xcuitest-driver').createJSCookie;2var cookie = createJSCookie('key', 'value', 'domain', 'path', 'expiry', 'secure', 'httpOnly');3console.log(cookie);4var createCookie = require('appium-xcuitest-driver').createCookie;5var cookie = createCookie('key', 'value', 'domain', 'path', 'expiry', 'secure', 'httpOnly');6console.log(cookie);7var createCookie = require('appium-xcuitest-driver').createCookie;8var cookie = createCookie('key', 'value', 'domain', 'path', 'expiry', 'secure', 'httpOnly');9console.log(cookie);10var createCookie = require('appium-xcuitest-driver').createCookie;11var cookie = createCookie('key', 'value', 'domain', 'path', 'expiry', 'secure', 'httpOnly');12console.log(cookie);13var createCookie = require('appium-xcuitest-driver').createCookie;14var cookie = createCookie('key', 'value', 'domain', 'path', 'expiry', 'secure', 'httpOnly');15console.log(cookie);16var createCookie = require('appium-xcuitest-driver').createCookie;17var cookie = createCookie('key', 'value', 'domain', 'path', 'expiry', 'secure', 'httpOnly');18console.log(cookie);19var createCookie = require('appium-xcuitest-driver').createCookie;20var cookie = createCookie('key', 'value', 'domain', 'path', 'expiry', 'secure', 'httpOnly');21console.log(cookie);22var createCookie = require('appium-xcuitest-driver').createCookie;23var cookie = createCookie('key', 'value', 'domain', 'path', 'expiry', 'secure', 'httpOnly');

Full Screen

Using AI Code Generation

copy

Full Screen

1var createJSCookie = driver.executeScript('mobile: createJSCookie', {name: 'myCookie', value: 'myValue'});2createJSCookie.then(function(cookie) {3});4var deleteAllCookies = driver.executeScript('mobile: deleteAllCookies', {});5deleteAllCookies.then(function() {6 console.log('All cookies deleted');7});8var deleteCookie = driver.executeScript('mobile: deleteCookie', {name: 'myCookie'});9deleteCookie.then(function() {10 console.log('Cookie deleted');11});12var getCookies = driver.executeScript('mobile: getCookies', {});13getCookies.then(function(cookies) {14});15var setJSCookie = driver.executeScript('mobile: setJSCookie', {name: 'myCookie', value: 'myValue'});16setJSCookie.then(function(cookie) {17});18var setNetworkConnection = driver.executeScript('mobile: setNetworkConnection', {parameters: {type: 'wifi'}});19setNetworkConnection.then(function() {20 console.log('Network connection set');21});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { createJSCookie } from 'appium-xcuitest-driver';2import { getDriver } from './helpers';3const driver = getDriver();4const cookie = createJSCookie('foo', 'bar', 'example.com', '/foo', 86400, true, false);5await driver.setCookies([cookie]);6const cookies = await driver.getCookies();7console.log(cookies);8[ { name: 'foo',9 secure: true } ]10import { createJSCookie } from 'appium-xcuitest-driver';11import { getDriver } from './helpers';12const driver = getDriver();13const cookie = createJSCookie('foo', 'bar', 'example.com', '/foo', 86400, true, false);14await driver.setCookies([cookie]);15const cookies = await driver.getCookies();16console.log(cookies);17[ { name: 'foo',18 secure: true } ]19import { createJSCookie } from 'appium-xcuitest-driver';20import { getDriver } from './helpers';21const driver = getDriver();22const cookie = createJSCookie('foo', 'bar', 'example.com', '/foo', 86400, true, false);23await driver.setCookies([cookie]);24const cookies = await driver.getCookies();25console.log(cookies);26[ { name: 'foo',27 secure: true } ]

Full Screen

Using AI Code Generation

copy

Full Screen

1var createJSCookie = require('appium-xcuitest-driver/lib/commands/cookies').createJSCookie;2var cookie = createJSCookie('test', 'value', 'localhost', '/', 100000, true, true);3console.log(cookie);4var createCookie = require('appium-xcuitest-driver/lib/commands/cookies').createCookie;5var cookie = createCookie('test', 'value', 'localhost', '/', 100000, true, true);6console.log(cookie);7var createCookie = require('appium-xcuitest-driver/lib/commands/cookies').createCookie;8var cookie = createCookie('test', 'value', 'localhost', '/', 100000, true, true);9console.log(cookie);10var createCookie = require('appium-xcuitest-driver/lib/commands/cookies').createCookie;11var cookie = createCookie('test', 'value', 'localhost', '/', 100000, true, true);12console.log(cookie);13var createCookie = require('appium-xcuitest-driver/lib/commands/cookies').createCookie;14var cookie = createCookie('test', 'value', 'localhost', '/', 100000, true, true);15console.log(cookie);16var createCookie = require('appium-xcuitest-driver/lib/commands/cookies').createCookie;17var cookie = createCookie('test', 'value', 'localhost', '/', 100000, true, true);18console.log(cookie);19var createCookie = require('appium-xcuitest-driver/lib/commands/cookies').createCookie;20var cookie = createCookie('test', 'value', 'localhost', '/', 100000, true, true);21console.log(cookie);22var createCookie = require('appium-xcuitest-driver/lib/commands/cookies').createCookie;23var cookie = createCookie('test', 'value', 'localhost', '/',

Full Screen

Using AI Code Generation

copy

Full Screen

1var cookie = driver.createJSCookie('test', 'test', 'test.com', '/', 1000000000, true, true);2console.log(cookie);3var cookie = driver.deleteJSCookie('test', 'test.com', '/', 'test');4console.log(cookie);5var cookies = driver.getJSCookies('test.com', '/');6console.log(cookies);7var cookie = driver.setJSCookie('test', 'test', 'test.com', '/', 1000000000, true, true);8console.log(cookie);9var cookies = driver.setJSCookies([{'test': 'test'}, {'test2': 'test2'}]);10console.log(cookies);11var cookies = driver.clearJSCookies();12console.log(cookies);13var cookie = driver.getJSCookie('test', 'test.com', '/');14console.log(cookie);15var cookies = driver.setJSCookies([{'test': 'test'}, {'test2': 'test2'}]);16console.log(cookies);17var cookies = driver.clearJSCookies();18console.log(cookies);19var cookie = driver.getJSCookie('test', 'test.com', '/');20console.log(cookie);21var cookies = driver.setJSCookies([{'test': 'test'}, {'test2': 'test2'}]);22console.log(cookies);23var cookies = driver.clearJSCookies();24console.log(cookies);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful