InterviewSolution
| 1. |
Name Some Method Of Phantomjs? |
|
Answer» FOLLOWING methods are helping us to execute JavaScript without the BROWSER: addCookie: This method is used for adding cookies in CookieJar. If SUCCESSFULLY added it return true otherwise false. PHANTOM.addCookie({ 'name' : 'Cookie name', 'value' : 'Cookie value', 'domain' : 'localhost' }); clearCookies: This method used to delete all the cookies from Cookiejar. phantom.clearCookies(); deleteCookie: It is used for deleting cookie from Cookiejar by using 'name' property matching chookieName. phantom.deleteCookie('Cookie name'); exit: This method exit the program when return SPECIFIC return value. It there is no specific return value it return '0'. specific return value it return '0'. if(condation){ phantom.exit(1); }else{ phantom.exit(0): } injectJs: It injects external file from specified file into phantom. If file does not found in current directory, then libraryPath property of Phantos is used as an additional place to track the path. var addSuccess= phantom.injectJs(filename); consol.log(addSuccess); phantom.exit(); Following methods are helping us to execute JavaScript without the browser: addCookie: This method is used for adding cookies in CookieJar. If successfully added it return true otherwise false. phantom.addCookie({ 'name' : 'Cookie name', 'value' : 'Cookie value', 'domain' : 'localhost' }); clearCookies: This method used to delete all the cookies from Cookiejar. phantom.clearCookies(); deleteCookie: It is used for deleting cookie from Cookiejar by using 'name' property matching chookieName. phantom.deleteCookie('Cookie name'); exit: This method exit the program when return specific return value. It there is no specific return value it return '0'. specific return value it return '0'. if(condation){ phantom.exit(1); }else{ phantom.exit(0): } injectJs: It injects external file from specified file into phantom. If file does not found in current directory, then libraryPath property of Phantos is used as an additional place to track the path. var addSuccess= phantom.injectJs(filename); consol.log(addSuccess); phantom.exit(); |
|