jd-m3 / keep-instance-alive Goto Github PK
View Code? Open in Web Editor NEWKeep ServiceNow developer instance alive
Keep ServiceNow developer instance alive
So, I found out that the script doesn't work when running on headless mode. Also, found it the hard way since I got my developer instance reclaimed again ๐
For the mean time, I got few workarounds while trying to figure out how to make this thing work in headless mode:
Use a GUI-based Ubuntu VM so the script can use the browser to refresh the instance daily (still using a CRON job)
Fire the script manually using my Workspace PC (am using Windows)
Also, pull requests are welcome if you happen to have a solution to make this work on headless mode.
`PS C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master> npm run app
[email protected] app C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master
concurrently --kill-others "npm run webdriver" "npm run index"
[0]
[0] > [email protected] webdriver C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master
[0] > java -jar selenium-server/selenium-server-standalone-3.13.0.jar
[0]
[1]
[1] > [email protected] index C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master
[1] > node index.js
[1]
[1] (node:17020) UnhandledPromiseRejectionWarning: Error: The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found on your PATH.
[1] at new ServiceBuilder (C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master\node_modules\selenium-webdriver\chrome.js:232:13)
[1] at getDefaultService (C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master\node_modules\selenium-webdriver\chrome.js:321:22)
[1] at Function.createSession (C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master\node_modules\selenium-webdriver\chrome.js:695:44)
[1] at createDriver (C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master\node_modules\selenium-webdriver\index.js:155:33)
[1] at Builder.build (C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master\node_modules\selenium-webdriver\index.js:662:16)
[1] at C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master\index.js:36:6
[1] at Object. (C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master\index.js:95:3)
[1] at Module._compile (internal/modules/cjs/loader.js:778:30)
[1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
[1] at Module.load (internal/modules/cjs/loader.js:653:32)
[0] 09:10:09.454 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.13.0', revision: '2f0d292'
[0] 09:10:09.460 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
[1] (node:17020) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
[1] (node:17020) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[1] npm run index exited with code 0
--> Sending SIGTERM to other processes..
[0] 2019-09-12 09:10:09.776:INFO::main: Logging initialized @725ms to org.seleniumhq.jetty9.util.log.StdErrLog
[0] npm run webdriver exited with code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] app: concurrently --kill-others "npm run webdriver" "npm run index"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] app script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mrkel\AppData\Roaming\npm-cache_logs\2019-09-12T16_10_10_018Z-debug.log
PS C:\Users\mrkel\Desktop\ServiceNow Community Code\keep-instance-alive-master> `
I've tried using both the chromedriver and geckodriver installations, and the code is hanging in different places with each.
I'm on a Macbook Pro with Mojave 10.14.6 and the latest version of both browsers.
When using Firefox it hangs at the point where the email address is entered into the username field and the button click happens.
With Chrome it never seems to redirect to the login page.
I've added a bunch of console.log() statements to track each step of the process, and was able to verify where it hangs by watching each step in the process.
Is this still working for you @jd-m3?
It looks like you've accommodated the new login page processing that they use on the developer site, but something isn't happy. I've looked into the page source and all of the fields and button names seem to be correct, but no joy for me. Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.