How to get the DOM.shadowRootPushed event from chrome? - google-chrome

I've been trying to get the DOM.shadowRootPushed event using the CDPSession from puppeteer.
Here's the page that is loaded with contains the shadowRoot:
<html>
<head>
<title>
Page with Shadow Root
</title>
</head>
<body>
<header id="host">
<h1>Hello DOM</h1>
</header>
</body>
<script>
var attachShadow = HTMLElement.prototype.attachShadow
HTMLElement.prototype.attachShadow = function ( option )
{
var sh = attachShadow.call( this, option )
console.info( '%s shadow attached to %s', option.mode, this )
//add a MutationObserver here
return sh
}
setTimeout(function() {
const host = document.getElementById('host');
const shadowRoot = host.attachShadow({mode: 'open'});
shadowRoot.innerHTML = '<h1>Hello Shadow DOM</h1>';
}, 3300);
</script>
</html>
and, I'm using this script to get the event:
const puppeteer = require('puppeteer');
(async() => {
// Use Puppeteer to launch a browser and open a page.
const browser = await puppeteer.launch({
headless: false
// userDataDir: "/home/w/.config/chromium/"
});
const page = await browser.newPage();
// Create a raw DevTools protocol session to talk to the page.
// Use CDP to set the animation playback rate.
const session = await page.target().createCDPSession();
await session.send('Animation.enable');
await session.send('DOM.enable');
session.on('Animation.animationCreated', () => {
console.log('Animation created!');
});
session.on('DOM.shadowRootPushed', () => {
console.log('DOM.shadowRootPushed');
});
session.on('DOM.shadowRootPopped', () => {
console.log('DOM.shadowRootPopped');
});
await session.send('Animation.setPlaybackRate', {
playbackRate: 2,
});
// Check it out! Fast animations on the "loading..." screen!
// await page.goto('https://pptr.dev');
await page.goto('http://localhost:8000');
await wait(1115000)
console.log("Done")
})();
async function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
I'm getting the Animation.animationCreated though. The CDP website say that DOM.shadowRootPushed is an experimental event. Does it require a flag to be passed in the launch options?
Dependencies:
"dependencies": {
"puppeteer": "8.0.0",
"ws": "7.2.3"
},
Chrome Version : Version 90.0.4427.0 (Developer Build) (64-bit)
DEBUG logs:
$ DEBUG=* node cdpsession.js
puppeteer:protocol SEND ► {"method":"Target.setDiscoverTargets","params":{"discover":true},"id":1} +0ms
puppeteer:protocol ◀ RECV {"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"3462A6199ADAF347FD96DF0016967C81","type":"page","title":"","url":"about:blank","attached":false,"browserContextId":"9DD61B1C854229B47F6F3A16F46B1AF0"}}} +41ms
puppeteer:protocol ◀ RECV {"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"3995d8d1-5e35-48ff-b5c6-faf339b9ec9a","type":"browser","title":"","url":"","attached":true}}} +1ms
puppeteer:protocol ◀ RECV {"id":1,"result":{}} +0ms
puppeteer:protocol SEND ► {"method":"Target.createTarget","params":{"url":"about:blank"},"id":2} +1ms
puppeteer:protocol ◀ RECV {"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"3462A6199ADAF347FD96DF0016967C81","type":"page","title":"about:blank","url":"about:blank","attached":false,"browserContextId":"9DD61B1C854229B47F6F3A16F46B1AF0"}}} +6ms
puppeteer:protocol ◀ RECV {"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"6DAD742822835DE715BE5F8B09EC00BD","type":"page","title":"","url":"about:blank","attached":false,"browserContextId":"9DD61B1C854229B47F6F3A16F46B1AF0"}}} +13ms
puppeteer:protocol ◀ RECV {"id":2,"result":{"targetId":"6DAD742822835DE715BE5F8B09EC00BD"}} +11ms
puppeteer:protocol SEND ► {"method":"Target.attachToTarget","params":{"targetId":"6DAD742822835DE715BE5F8B09EC00BD","flatten":true},"id":3} +0ms
puppeteer:protocol ◀ RECV {"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"6DAD742822835DE715BE5F8B09EC00BD","type":"page","title":"","url":"about:blank","attached":true,"browserContextId":"9DD61B1C854229B47F6F3A16F46B1AF0"}}} +18ms
puppeteer:protocol ◀ RECV {"method":"Target.attachedToTarget","params":{"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","targetInfo":{"targetId":"6DAD742822835DE715BE5F8B09EC00BD","type":"page","title":"","url":"about:blank","attached":true,"browserContextId":"9DD61B1C854229B47F6F3A16F46B1AF0"},"waitingForDebugger":false}} +1ms
puppeteer:protocol ◀ RECV {"id":3,"result":{"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"}} +0ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Page.enable","params":{},"id":4} +1ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Page.getFrameTree","params":{},"id":5} +0ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":false,"flatten":true},"id":6} +0ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Performance.enable","params":{},"id":7} +0ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Log.enable","params":{},"id":8} +1ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Page.setInterceptFileChooserDialog","params":{"enabled":true},"id":9} +0ms
puppeteer:protocol ◀ RECV {"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"6DAD742822835DE715BE5F8B09EC00BD","type":"page","title":"about:blank","url":"about:blank","attached":true,"browserContextId":"9DD61B1C854229B47F6F3A16F46B1AF0"}}} +11ms
puppeteer:protocol ◀ RECV {"id":9,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +4ms
puppeteer:protocol ◀ RECV {"id":4,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +13ms
puppeteer:protocol ◀ RECV {"id":5,"result":{"frameTree":{"frame":{"id":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"C4BEDF25BD814B4DC16699169B6EF1F7","url":"about:blank","securityOrigin":"://","mimeType":"text/html"}}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +1ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Page.setLifecycleEventsEnabled","params":{"enabled":true},"id":10} +0ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Runtime.enable","params":{},"id":11} +0ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Network.enable","params":{},"id":12} +0ms
puppeteer:protocol ◀ RECV {"id":6,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +1ms
puppeteer:protocol ◀ RECV {"id":7,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Log.entryAdded","params":{"entry":{"source":"other","level":"error","text":"Site cannot be installed: Page is not served from a secure origin","timestamp":1618302904174.339,"url":"about:blank"}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"id":8,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"C4BEDF25BD814B4DC16699169B6EF1F7","name":"commit","timestamp":195993.959226},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +4ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"C4BEDF25BD814B4DC16699169B6EF1F7","name":"DOMContentLoaded","timestamp":195993.959313},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"C4BEDF25BD814B4DC16699169B6EF1F7","name":"load","timestamp":195993.961627},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +1ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"C4BEDF25BD814B4DC16699169B6EF1F7","name":"networkAlmostIdle","timestamp":195993.961976},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"C4BEDF25BD814B4DC16699169B6EF1F7","name":"networkIdle","timestamp":195993.961976},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"id":10,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"context":{"id":1,"origin":"://","name":"","auxData":{"isDefault":true,"type":"default","frameId":"6DAD742822835DE715BE5F8B09EC00BD"}}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"id":11,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"id":12,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Page.addScriptToEvaluateOnNewDocument","params":{"source":"//# sourceURL=__puppeteer_evaluation_script__","worldName":"__puppeteer_utility_world__"},"id":13} +0ms
puppeteer:protocol ◀ RECV {"id":13,"result":{"identifier":"1"},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +1ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Page.createIsolatedWorld","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","grantUniveralAccess":true,"worldName":"__puppeteer_utility_world__"},"id":14} +0ms
puppeteer:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"context":{"id":2,"origin":"","name":"__puppeteer_utility_world__","auxData":{"isDefault":false,"type":"isolated","frameId":"6DAD742822835DE715BE5F8B09EC00BD"}}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +4ms
puppeteer:protocol ◀ RECV {"id":14,"result":{"executionContextId":2},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Emulation.setDeviceMetricsOverride","params":{"mobile":false,"width":800,"height":600,"deviceScaleFactor":1,"screenOrientation":{"angle":0,"type":"portraitPrimary"}},"id":15} +1ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Emulation.setTouchEmulationEnabled","params":{"enabled":false},"id":16} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.frameResized","params":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +4ms
puppeteer:protocol ◀ RECV {"id":15,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"id":16,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol SEND ► {"method":"Target.attachToTarget","params":{"targetId":"6DAD742822835DE715BE5F8B09EC00BD","flatten":true},"id":17} +0ms
puppeteer:protocol ◀ RECV {"method":"Target.attachedToTarget","params":{"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15","targetInfo":{"targetId":"6DAD742822835DE715BE5F8B09EC00BD","type":"page","title":"about:blank","url":"about:blank","attached":true,"browserContextId":"9DD61B1C854229B47F6F3A16F46B1AF0"},"waitingForDebugger":false}} +1ms
puppeteer:protocol ◀ RECV {"id":17,"result":{"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"}} +0ms
puppeteer:protocol SEND ► {"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15","method":"Animation.enable","params":{},"id":18} +1ms
puppeteer:protocol ◀ RECV {"id":18,"result":{},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +0ms
puppeteer:protocol SEND ► {"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15","method":"Page.enable","params":{},"id":19} +0ms
puppeteer:protocol ◀ RECV {"id":19,"result":{},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +1ms
puppeteer:protocol SEND ► {"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15","method":"DOM.enable","params":{},"id":20} +0ms
puppeteer:protocol ◀ RECV {"id":20,"result":{},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +0ms
puppeteer:protocol SEND ► {"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15","method":"Animation.setPlaybackRate","params":{"playbackRate":2},"id":21} +1ms
puppeteer:protocol ◀ RECV {"id":21,"result":{},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +4ms
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Page.navigate","params":{"url":"http://localhost:8000","frameId":"6DAD742822835DE715BE5F8B09EC00BD"},"id":22} +3ms
puppeteer:protocol ◀ RECV {"method":"Network.requestWillBeSent","params":{"requestId":"946E1DE1FC063361360B31998681705C","loaderId":"946E1DE1FC063361360B31998681705C","documentURL":"http://localhost:8000/","request":{"url":"http://localhost:8000/","method":"GET","headers":{"sec-ch-ua":"Chromium 78","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3882.0 Safari/537.36","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-User":"?1"},"mixedContentType":"none","initialPriority":"VeryHigh","referrerPolicy":"no-referrer-when-downgrade"},"timestamp":195994.030865,"wallTime":1618302904.223556,"initiator":{"type":"other"},"type":"Document","frameId":"6DAD742822835DE715BE5F8B09EC00BD","hasUserGesture":false},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +5ms
puppeteer:protocol ◀ RECV {"method":"Network.responseReceivedExtraInfo","params":{"requestId":"946E1DE1FC063361360B31998681705C","blockedCookies":[],"headers":{"Server":"SimpleHTTP/0.6 Python/3.8.5","Date":"Tue, 13 Apr 2021 07:33:36 GMT","Content-type":"text/html","Content-Length":"656","Last-Modified":"Mon, 12 Apr 2021 17:02:56 GMT"},"headersText":"HTTP/1.0 200 OK\r\nServer: SimpleHTTP/0.6 Python/3.8.5\r\nDate: Tue, 13 Apr 2021 07:33:36 GMT\r\nContent-type: text/html\r\nContent-Length: 656\r\nLast-Modified: Mon, 12 Apr 2021 17:02:56 GMT\r\n\r\n"},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +4ms
puppeteer:protocol ◀ RECV {"method":"Network.responseReceived","params":{"requestId":"946E1DE1FC063361360B31998681705C","loaderId":"946E1DE1FC063361360B31998681705C","timestamp":195994.034773,"type":"Document","response":{"url":"http://localhost:8000/","status":200,"statusText":"OK","headers":{"Server":"SimpleHTTP/0.6 Python/3.8.5","Date":"Tue, 13 Apr 2021 07:33:36 GMT","Content-type":"text/html","Content-Length":"656","Last-Modified":"Mon, 12 Apr 2021 17:02:56 GMT"},"headersText":"HTTP/1.0 200 OK\r\nServer: SimpleHTTP/0.6 Python/3.8.5\r\nDate: Tue, 13 Apr 2021 07:33:36 GMT\r\nContent-type: text/html\r\nContent-Length: 656\r\nLast-Modified: Mon, 12 Apr 2021 17:02:56 GMT\r\n\r\n","mimeType":"text/html","connectionReused":false,"connectionId":0,"remoteIPAddress":"127.0.0.1","remotePort":8000,"fromDiskCache":true,"fromServiceWorker":false,"fromPrefetchCache":false,"encodedDataLength":0,"timing":{"requestTime":195994.031508,"proxyStart":-1,"proxyEnd":-1,"dnsStart":-1,"dnsEnd":-1,"connectStart":-1,"connectEnd":-1,"sslStart":-1,"sslEnd":-1,"workerStart":-1,"workerReady":-1,"sendStart":0.047,"sendEnd":0.047,"pushStart":0,"pushEnd":0,"receiveHeadersEnd":0.252},"protocol":"http/1.0","securityState":"secure"},"frameId":"6DAD742822835DE715BE5F8B09EC00BD"},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"id":22,"result":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C"},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +2ms
puppeteer:protocol ◀ RECV {"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"6DAD742822835DE715BE5F8B09EC00BD","type":"page","title":"localhost:8000","url":"http://localhost:8000/","attached":true,"browserContextId":"9DD61B1C854229B47F6F3A16F46B1AF0"}}} +27ms
puppeteer:protocol ◀ RECV {"method":"Page.frameStartedLoading","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD"},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +2ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","name":"init","timestamp":195994.038172},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":1},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":2},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Runtime.executionContextsCleared","params":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.frameNavigated","params":{"frame":{"id":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","url":"http://localhost:8000/","securityOrigin":"http://localhost:8000","mimeType":"text/html"}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"context":{"id":3,"origin":"http://localhost:8000","name":"","auxData":{"isDefault":true,"type":"default","frameId":"6DAD742822835DE715BE5F8B09EC00BD"}}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"context":{"id":4,"origin":"://","name":"__puppeteer_utility_world__","auxData":{"isDefault":false,"type":"isolated","frameId":"6DAD742822835DE715BE5F8B09EC00BD"}}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.frameStartedLoading","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD"},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.frameNavigated","params":{"frame":{"id":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","url":"http://localhost:8000/","securityOrigin":"http://localhost:8000","mimeType":"text/html"}},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +0ms
puppeteer:protocol ◀ RECV {"method":"DOM.documentUpdated","params":{},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +0ms
puppeteer:protocol ◀ RECV {"method":"Network.dataReceived","params":{"requestId":"946E1DE1FC063361360B31998681705C","timestamp":195994.066566,"dataLength":656,"encodedDataLength":0},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +3ms
puppeteer:protocol ◀ RECV {"method":"Network.loadingFinished","params":{"requestId":"946E1DE1FC063361360B31998681705C","timestamp":195994.032156,"encodedDataLength":0,"shouldReportCorbBlocking":false},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.loadEventFired","params":{"timestamp":195994.070869},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +45ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","name":"load","timestamp":195994.070869},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +1ms
puppeteer:protocol ◀ RECV {"method":"Page.frameStoppedLoading","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD"},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.domContentEventFired","params":{"timestamp":195994.097616},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","name":"DOMContentLoaded","timestamp":195994.097616},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.loadEventFired","params":{"timestamp":195994.070878},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.frameStoppedLoading","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD"},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +1ms
puppeteer:protocol ◀ RECV {"method":"DOM.documentUpdated","params":{},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.domContentEventFired","params":{"timestamp":195994.09762},"sessionId":"0313B2AD0426A7188BC93EBA3D6F8D15"} +0ms
puppeteer:protocol ◀ RECV {"method":"Log.entryAdded","params":{"entry":{"source":"other","level":"error","text":"Site cannot be installed: Page has no manifest <link> URL","timestamp":1618302904323.69,"url":"http://localhost:8000/"}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +18ms
puppeteer:protocol ◀ RECV {"method":"Network.requestWillBeSent","params":{"requestId":"1000037436.2","loaderId":"946E1DE1FC063361360B31998681705C","documentURL":"http://localhost:8000/","request":{"url":"http://localhost:8000/favicon.ico","method":"GET","headers":{"sec-ch-ua":"Chromium 78","Sec-Fetch-Mode":"no-cors","Referer":"http://localhost:8000/","Sec-Fetch-Dest":"image","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3882.0 Safari/537.36"},"mixedContentType":"none","initialPriority":"High","referrerPolicy":"no-referrer-when-downgrade"},"timestamp":195994.132074,"wallTime":1618302904.324764,"initiator":{"type":"other"},"type":"Other","frameId":"6DAD742822835DE715BE5F8B09EC00BD","hasUserGesture":false},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +1ms
puppeteer:protocol ◀ RECV {"method":"Network.requestWillBeSentExtraInfo","params":{"requestId":"1000037436.2","blockedCookies":[],"headers":{"Host":"localhost:8000","Connection":"keep-alive","sec-ch-ua":"Chromium 78","Sec-Fetch-Mode":"no-cors","Sec-Fetch-Dest":"image","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3882.0 Safari/537.36","Accept":"image/webp,image/apng,image/*,*/*;q=0.8","Sec-Fetch-Site":"same-origin","Referer":"http://localhost:8000/","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-GB,en-US;q=0.9,en;q=0.8"}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Network.responseReceivedExtraInfo","params":{"requestId":"1000037436.2","blockedCookies":[],"headers":{"Server":"SimpleHTTP/0.6 Python/3.8.5","Date":"Tue, 13 Apr 2021 08:35:04 GMT","Connection":"close","Content-Type":"text/html;charset=utf-8","Content-Length":"469"},"headersText":"HTTP/1.0 404 File not found\r\nServer: SimpleHTTP/0.6 Python/3.8.5\r\nDate: Tue, 13 Apr 2021 08:35:04 GMT\r\nConnection: close\r\nContent-Type: text/html;charset=utf-8\r\nContent-Length: 469\r\n\r\n"},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +4ms
puppeteer:protocol ◀ RECV {"method":"Network.responseReceived","params":{"requestId":"1000037436.2","loaderId":"946E1DE1FC063361360B31998681705C","timestamp":195994.136327,"type":"Other","response":{"url":"http://localhost:8000/favicon.ico","status":404,"statusText":"File not found","headers":{"Date":"Tue, 13 Apr 2021 08:35:04 GMT","Server":"SimpleHTTP/0.6 Python/3.8.5","Connection":"close","Content-Length":"469","Content-Type":"text/html;charset=utf-8"},"mimeType":"text/html","connectionReused":true,"connectionId":21,"remoteIPAddress":"127.0.0.1","remotePort":8000,"fromDiskCache":false,"fromServiceWorker":false,"fromPrefetchCache":false,"encodedDataLength":184,"timing":{"requestTime":195994.132935,"proxyStart":-1,"proxyEnd":-1,"dnsStart":-1,"dnsEnd":-1,"connectStart":-1,"connectEnd":-1,"sslStart":-1,"sslEnd":-1,"workerStart":-1,"workerReady":-1,"sendStart":0.164,"sendEnd":0.222,"pushStart":0,"pushEnd":0,"receiveHeadersEnd":2.581},"protocol":"http/1.0","securityState":"secure"},"frameId":"6DAD742822835DE715BE5F8B09EC00BD"},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Log.entryAdded","params":{"entry":{"source":"network","level":"error","text":"Failed to load resource: the server responded with a status of 404 (File not found)","timestamp":1618302904329.0269,"url":"http://localhost:8000/favicon.ico","networkRequestId":"1000037436.2"}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Network.dataReceived","params":{"requestId":"1000037436.2","timestamp":195994.136494,"dataLength":469,"encodedDataLength":0},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +1ms
puppeteer:protocol ◀ RECV {"method":"Network.dataReceived","params":{"requestId":"1000037436.2","timestamp":195994.136661,"dataLength":0,"encodedDataLength":469},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Network.loadingFinished","params":{"requestId":"1000037436.2","timestamp":195994.135926,"encodedDataLength":653,"shouldReportCorbBlocking":false},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","name":"firstPaint","timestamp":195994.137751},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +8ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","name":"firstContentfulPaint","timestamp":195994.137751},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +1ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","name":"firstMeaningfulPaintCandidate","timestamp":195994.137751},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +12ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","name":"networkAlmostIdle","timestamp":195994.097621},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +639ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","name":"firstMeaningfulPaint","timestamp":195994.137751},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"6DAD742822835DE715BE5F8B09EC00BD","loaderId":"946E1DE1FC063361360B31998681705C","name":"networkIdle","timestamp":195994.136668},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +0ms
puppeteer:protocol ◀ RECV {"method":"Runtime.consoleAPICalled","params":{"type":"info","args":[{"type":"string","value":"+9s shadow attached to %s"},{"type":"string","value":"open"},{"type":"object","subtype":"node","className":"HTMLElement","description":"header#host","objectId":"{\"injectedScriptId\":3,\"id\":1}","preview":{"type":"object","subtype":"node","description":"header#host","overflow":true,"properties":[{"name":"title","type":"string","value":""},{"name":"lang","type":"string","value":""},{"name":"translate","type":"boolean","value":"true"},{"name":"dir","type":"string","value":""},{"name":"dataset","type":"object","value":"DOMStringMap"}]}}],"executionContextId":3,"timestamp":1618302914264.107,"stackTrace":{"callFrames":[{"functionName":"HTMLElement.attachShadow","scriptId":"14","url":"http://localhost:8000/","lineNumber":17,"columnNumber":12},{"functionName":"","scriptId":"14","url":"http://localhost:8000/","lineNumber":23,"columnNumber":28}]}},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"}
puppeteer:protocol SEND ► {"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB","method":"Runtime.releaseObject","params":{"objectId":"{\"injectedScriptId\":3,\"id\":1}"},"id":23} +1ms
puppeteer:protocol ◀ RECV {"id":23,"result":{},"sessionId":"D9D90F0C9845C459A09442F9B0E0F0EB"} +1ms
Update:
Based on the comments, I've added the following flags:
args: [
'--enable-blink-test-features',
'--enable-experimental-web-platform-features',
'--fake-variations-channel=canary'
]
and applied dev, beta, canary, stable for --fake-variations-channel. The notification was not captured.

Related

WSO2 Not a valid protocol version: <head> For

I'm trying to call a http-EndPoint with POST method in WSO2 Enterprise Integrator. This EndPoint gets a JSON object as input and return a JSON object as response.
Until now I've used various types of http-EndPoints in Enterprise Integrator without any problem but this particular EndPoint returns an error message which I'm not able to find any clue about it in google.
This is my api:
<resource methods="POST" uri-template="/userInfo">
<inSequence>
<payloadFactory media-type="json">
<format>{"jsonrpc": "2.0", "params": {"auth_type": "ADMIN", "auth_name": "someName", "normal_username": "$1", "auth_pass": "myPassword"},"method": "user.MethodName", "id": 0}
</format>
<args>
<arg evaluator="json" expression="$.user"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property name="FORCE_HTTP_1.0" scope="axis2" type="STRING" value="true"/>
<send description="">
<endpoint>
<http method="post" uri-template="http://192.168.1.50:1237"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</resource>
This is my error message in console:
[EI-Core] ERROR - TargetHandler HTTP protocol violation : Not a valid protocol version: <head> For : 192.168.1.50:1237
UPDATE
I enabled Wire Logs in WSO2 to investigate in depth about this issue. Here is log output:
[2018-01-15 09:30:46,621] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "POST HTTP/1.0[\r][\n]"
[2018-01-15 09:30:46,622] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "Expect: 100-continue[\r][\n]"
[2018-01-15 09:30:46,622] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "Content-Type: application/json[\r][\n]"
[2018-01-15 09:30:46,622] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "Content-Length: 196[\r][\n]"
[2018-01-15 09:30:46,622] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "Host: 192.168.1.50:1237[\r][\n]"
[2018-01-15 09:30:46,622] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "Connection: Keep-Alive[\r][\n]"
[2018-01-15 09:30:46,622] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2018-01-15 09:30:46,622] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "[\r][\n]"
[2018-01-15 09:30:46,622] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "{"jsonrpc": "2.0", "params": {"auth_type": "ADMIN", "auth_name": "someName", "normal_username": "myUserName", "auth_pass": "myPassword", "remote_addr": "127.0.0.1"},"method": "user.MethodName", "id": 0}"
[2018-01-15 09:30:46,623] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "<head>[\n]"
[2018-01-15 09:30:46,623] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "<title>Error response</title>[\n]"
[2018-01-15 09:30:46,624] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "</head>[\n]"
[2018-01-15 09:30:46,624] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "<body>[\n]"
[2018-01-15 09:30:46,624] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "<h1>Error response</h1>[\n]"
[2018-01-15 09:30:46,624] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "<p>Error code 400.[\n]"
[2018-01-15 09:30:46,624] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "<p>Message: Bad HTTP/0.9 request type ('POST').[\n]"
[2018-01-15 09:30:46,624] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "<p>Error code explanation: 400 = Bad request syntax or unsupported method.[\n]"
[2018-01-15 09:30:46,624] [EI-Core] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "</body>[\n]"
Although wire log returned this response: Message: Bad HTTP/0.9 request type ('POST'), but I can send post requests to Endpoint directly without any problem.
Here is direct post request to endpoint:
curl -v -H "Content-Type: application/json" -X POST -d '{"jsonrpc": "2.0", "params": {"auth_type": "ADMIN", "auth_name": "someName", "normal_username": "myUserName", "auth_pass": "myPassword", "remote_addr": "127.0.0.1"}, "method": "user.MethodName", "id": 0}' 192.168.1.50:1237
And here is output result:
STATE: INIT => CONNECT handle 0x600057950; line 1423 (connection #-5000)
Rebuilt URL to: http://192.168.1.50:1237/
Added connection 0. The cache now contains 1 members
Trying 5.202.129.107...
TCP_NODELAY set
STATE: CONNECT => WAITCONNECT handle 0x600057950; line 1475 (connection #0)
Connected to 192.168.1.50 (192.168.1.50) port 1237 (#0)
STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x600057950; line 1592 (connection #0)
Marked for [keep alive]: HTTP default
STATE: SENDPROTOCONNECT => DO handle 0x600057950; line 1610 (connection #0)
POST / HTTP/1.1
Host: http://192.168.1.50:1237
User-Agent: curl/7.56.1
Accept: /
Content-Type: application/json
Content-Length: 197
upload completely sent off: 197 out of 197 bytes
STATE: DO => DO_DONE handle 0x600057950; line 1689 (connection #0)
STATE: DO_DONE => WAITPERFORM handle 0x600057950; line 1814 (connection #0)
STATE: WAITPERFORM => PERFORM handle 0x600057950; line 1824 (connection #0)
HTTP 1.0, assume close after body
Marked for [closure]: HTTP/1.0 close after body < HTTP/1.0 200 OK < Server: BaseHTTP/0.3 Python/2.7.9 < Date: Sun, 14 Jan 2018 07:53:37
GMT < Content-type: application/json < Content-length: 2105 <
STATE: PERFORM => DONE handle 0x600057950; line 1993 (connection #0)
multi_done
Closing connection 0
The cache now contains 0 members
Expire cleared
When I compare headers from WSO2 to headers from curl I cant figure out what are differences. Why WSO2 request failed while curl request succeed?
Try adding this before the <send> mediator.
<property name="FORCE_HTTP_1.0" value="true" scope="axis2"/>
By comparing headers from WSO2 and curl I noticed this line in curl header Rebuilt URL to: http://192.168.1.50:1237/. Hence I changed this:
<endpoint>
<http method="post" uri-template="http://192.168.1.50:1237"/>
</endpoint>
To this:
<endpoint>
<http method="post" uri-template="http://192.168.1.50:1237/"/>
</endpoint>
Add the following properties to the sequence:
FORCE_HTTP_CONTENT_LENGTH
COPY_CONTENT_LENGTH_FROM_INCOMING
This solves the problem, but the reason still unknown.
from your wire log:
[2018-01-15 09:30:46,624] [EI-Core] DEBUG - wire HTTP-Sender I/O
dispatcher-1 >> "Message: Bad HTTP/0.9 request type ('POST').[\n]"
[2018-01-15 09:30:46,624] [EI-Core] DEBUG - wire HTTP-Sender I/O
dispatcher-1 >> "Error code explanation: 400 = Bad request syntax
or unsupported method.[\n]" [2018-01-15 09:30:46,624] [EI-Core] DEBUG
- wire HTTP-Sender I/O dispatcher-1 >> "[\n]"
Note: The official HTTP 0.9 specification included only one request method: GET.
you are using post which is not supported in HTTP 0.9
For more information about HTTP 0.9, refer to the original W3C HTTP specification.

no such session exception while Loading Default/Custom Chrome Profile to run tests using Selenium WebDriver

I am loading custom profile of chrome by using following code:
ChromeDriverService chSvc = new ChromeDriverService.Builder().usingDriverExecutable(new File("C://Users//kanu//Downloads//Selenium//chromedriver_win32//chromedriver.exe")).usingAnyFreePort().build();
ChromeOptions chOption = new ChromeOptions();
/**
* "user-data-dir = profilepath" --to open profile
* "--start-maximized" for maximize the browser
*/
chOption.addArguments("user-data-dir = C:/Users/kanu/AppData/Local/Google/Chrome/New User");
chOption.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(chSvc, chOption);
driver.get("https://www.google.com");
it works and run the existing profile of chrome but is not opening the desired url and getting following exception :
Starting ChromeDriver 2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9) on port 43388
Only local connections are allowed.
Mar 15, 2017 10:55:27 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.NoSuchSessionException: no such session
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.10586 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8 milliseconds
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'GUR-ACC093-W', ip: '100.102.83.217', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.10586 x86_64), platform=ANY}]
Session ID: ea04006993fa5bd7530cfe75cca7ae0d
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:638)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)
at launch.LaunchChrome.main(LaunchChrome.java:50)
Can anyone please resolve this?

ChromeDriver stop working after second run of protractor tests

I'm using docker, on first tab is running selenium, on second project, on third I run protractor tests. Conf file for protractor:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['todo-spec.js'],
framework: 'jasmine',
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--no-sandbox', '--disable-gpu', '--enable-logging=stderr', '--user-data-dir=/usr/src/app'],
},
},
onPrepare: function() {
var SpecReporter = require('jasmine-spec-reporter');
// add jasmine spec reporter
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
},
jasmineNodeOpts: {
print: function() {}
}
};
First run of tests is ok, here are logs for that:
Selenium Server is up and running
16:35:20.651 INFO - Executing: [new session: Capabilities [{count=1, browserName=chrome, chromeOptions={args=[--no-sandbox, --disable-gpu, --enable-logging=stderr, --user-data-dir=/usr/src/app]}}]])
16:35:20.699 INFO - Creating a new session for Capabilities [{count=1, browserName=chrome, chromeOptions={args=[--no-sandbox, --disable-gpu, --enable-logging=stderr, --user-data-dir=/usr/src/app]}}]
Starting ChromeDriver 2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac) on port 3980
Only local connections are allowed.
16:35:26.862 INFO - Done: [new session: Capabilities [{count=1, browserName=chrome, chromeOptions={args=[--no-sandbox, --disable-gpu, --enable-logging=stderr, --user-data-dir=/usr/src/app]}}]]
16:35:27.043 INFO - Executing: [set script timeout: 11000])
16:35:27.224 INFO - Done: [set script timeout: 11000]
16:35:32.447 INFO - Executing: [get: http://localhost:3000/keystone])
16:35:35.632 INFO - Done: [get: http://localhost:3000/keystone]
16:35:35.773 INFO - Executing: [find element: By.cssSelector: *[name="email"]])
16:35:36.606 INFO - Done: [find element: By.cssSelector: *[name="email"]]
16:35:36.657 INFO - Executing: [send keys: 0 [[ChromeDriver: chrome on LINUX (409a6b2de12c89405755981b76346cb0)] -> css selector: *[name="email"]], [m, c, g, l, a, b, s, #, g, m, a, i, l, ., c, o, m]])
16:35:37.137 INFO - Done: [send keys: 0 [[ChromeDriver: chrome on LINUX (409a6b2de12c89405755981b76346cb0)] -> css selector: *[name="email"]], [m, c, g, l, a, b, s, #, g, m, a, i, l, ., c, o, m]]
16:35:37.179 INFO - Executing: [find element: By.cssSelector: *[name="password"]])
16:35:37.249 INFO - Done: [find element: By.cssSelector: *[name="password"]]
16:35:37.282 INFO - Executing: [send keys: 1 [[ChromeDriver: chrome on LINUX (409a6b2de12c89405755981b76346cb0)] -> css selector: *[name="password"]], [p, a, s, s, w, o, r, d]])
16:35:37.936 INFO - Done: [send keys: 1 [[ChromeDriver: chrome on LINUX (409a6b2de12c89405755981b76346cb0)] -> css selector: *[name="password"]], [p, a, s, s, w, o, r, d]]
16:35:37.985 INFO - Executing: [find element: By.cssSelector: button[type="submit"]])
16:35:38.114 INFO - Done: [find element: By.cssSelector: button[type="submit"]]
16:35:38.327 INFO - Executing: [click: 2 [[ChromeDriver: chrome on LINUX (409a6b2de12c89405755981b76346cb0)] -> css selector: button[type="submit"]]])
16:35:39.094 INFO - Done: [click: 2 [[ChromeDriver: chrome on LINUX (409a6b2de12c89405755981b76346cb0)] -> css selector: button[type="submit"]]]
16:35:39.153 INFO - Executing: [get: http://localhost:3000/keystone/properties/])
16:35:40.447 INFO - Done: [get: http://localhost:3000/keystone/properties/]
16:35:40.483 INFO - Executing: [find element: By.cssSelector: .btn-create-item])
16:35:42.420 WARN - Exception thrown
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":".btn-create-item"}
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.4.27-moby x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.23 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: '9c29ea21cf96', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.27-moby', java.version: '1.7.0_111'
*** Element info: {Using=css selector, value=.btn-create-item}
Session ID: 409a6b2de12c89405755981b76346cb0
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/usr/src/app, chromedriverVersion=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac)}, networkConnectionEnabled=false, unexpectedAlertBehaviour=, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=55.0.2883.87, pageLoadStrategy=normal, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, hasTouchScreen=false, applicationCacheEnabled=false, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByCssSelector(RemoteWebDriver.java:492)
at org.openqa.selenium.By$ByCssSelector.findElement(By.java:430)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:103)
at com.sun.proxy.$Proxy1.findElement(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.findElement(EventFiringWebDriver.java:188)
at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:48)
at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
16:35:42.702 WARN - Exception: no such element: Unable to locate element: {"method":"css selector","selector":".btn-create-item"}
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.4.27-moby x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.23 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: '9c29ea21cf96', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.27-moby', java.version: '1.7.0_111'
*** Element info: {Using=css selector, value=.btn-create-item}
Session ID: 409a6b2de12c89405755981b76346cb0
But when I run second time protactor tests I got:
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/usr/src/app, chromedriverVersion=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac)}, networkConnectionEnabled=false, unexpectedAlertBehaviour=, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=55.0.2883.87, pageLoadStrategy=normal, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, hasTouchScreen=false, applicationCacheEnabled=false, takesScreenshot=true}]
16:38:43.511 INFO - Executing: [new session: Capabilities [{count=1, browserName=chrome, chromeOptions={args=[--no-sandbox, --disable-gpu, --enable-logging=stderr, --user-data-dir=/usr/src/app]}}]])
16:38:43.529 INFO - Creating a new session for Capabilities [{count=1, browserName=chrome, chromeOptions={args=[--no-sandbox, --disable-gpu, --enable-logging=stderr, --user-data-dir=/usr/src/app]}}]
Starting ChromeDriver 2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac) on port 20127
Only local connections are allowed.
Created new window in existing browser session.
16:39:44.925 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: '9c29ea21cf96', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.27-moby', java.version: '1.7.0_111'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:124)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:79)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:204)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:166)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: '9c29ea21cf96', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.27-moby', java.version: '1.7.0_111'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:113)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)
... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.4.27-moby x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 61.28 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: '9c29ea21cf96', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.27-moby', java.version: '1.7.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
... 14 more
16:39:44.939 WARN - Exception: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.4.27-moby x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 61.28 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: '9c29ea21cf96', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.27-moby', java.version: '1.7.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Exception: unknown error: Chrome failed to start: exited abnormally
It looks like that selenium try to connect to chromeDriver but without success. Have You any suggestion what is reason of problem ?

Bash script with cURL; not sending POST as JSON

I'm creating a simple bash script to run a cURL POST command.
The script, even though it is the same command does not send the POST data as json.
When I enter the command by hand it sends the POST data as JSON with no problem.
$ curl --include --header 'Accept:application/json' --header 'Authorization:Basic xxxxxxxxxxxxxxxxx' --data '{"sourceTemplateId":111111111111111}' --header 'Content-Type:application/json' https://api.everbridge.net/rest/notifications/000000000000000
HTTP/1.1 200 OK
Server: nginx/1.8.0
Date: Wed, 18 May 2016 18:13:15 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
{
"message" : "OK",
"id" : 5748251085623370,
"baseUri" : "https://api.everbridge.net/rest/notifications/000000000000000/",
"instanceUri" : "https://api.everbridge.net/rest/notifications/000000000000000/5748251085623370"
}
When I run an echo for my bash script, I get this.
$ ./Send_Not.sh
curl --include --header 'Accept:application/json' --header 'Authorization:Basic xxxxxxxxxxxxxxxxx' --data '{"sourceTemplateId":111111111111111}' --header 'Content-Type:application/json' https://api.everbridge.net/rest/notifications/000000000000000
Literally the same format
But when I run the script, I get this error.
$ ./Send_Not.sh
HTTP/1.1 415 Unsupported Media Type
Server: nginx/1.8.0
Date: Wed, 18 May 2016 18:28:50 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
{
"status" : 415,
"message" : "Content type 'application/x-www-form-urlencoded' not supported"
Here is my script, it's super simple.
#!/bin/bash
ajson=\'Accept:application/json\'
credentials=\'Authorization:Basic\ xxxxxxxxxxxxxxxxx\'
data=\'{\"sourceTemplateId\":111111111111111}\'
CT=\'Content-Type:application/json\'
url="https://api.everbridge.net/rest/notifications/000000000000000"
curl --include --header "$ajson" --header "$credentials" --data "$data" --header "$CT" "$url"
Reran the command with -X POST and -v
$ ./Send_Not.sh
Note: Unnecessary use of -X or --request, POST is already inferred.
* STATE: INIT => CONNECT handle 0x600057830; line 1108 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* Trying 54.193.84.167...
* STATE: CONNECT => WAITCONNECT handle 0x600057830; line 1161 (connection #0)
* Connected to api.everbridge.net (54.193.84.167) port 443 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x600057830; line 1260 (connection #0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:#STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x600057830; line 1274 (connection #0)
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-SHA
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; ST=California; L=Glendale; O=Everbridge; OU=SaaS Operations; CN=*.everbridge.net
* start date: Sep 18 00:00:00 2015 GMT
* expire date: Sep 17 23:59:59 2018 GMT
* subjectAltName: host "api.everbridge.net" matched cert's "*.everbridge.net"
* issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust SSL CA - G3
* SSL certificate verify ok.
* STATE: PROTOCONNECT => DO handle 0x600057830; line 1295 (connection #0)
> POST /rest/notifications/000000000000000 HTTP/1.1
> Host: api.everbridge.net
> User-Agent: curl/7.48.0
> Accept: */*
> 'Accept:application/json'
> 'Authorization:Basic xxxxxxxxxxxxxxxxx'
> 'Content-Type:application/json'
> Content-Length: 39
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 39 out of 39 bytes
* STATE: DO => DO_DONE handle 0x600057830; line 1357 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x600057830; line 1484 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x600057830; line 1494 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 415 Unsupported Media Type
HTTP/1.1 415 Unsupported Media Type
* Server nginx/1.8.0 is not blacklisted
< Server: nginx/1.8.0
Server: nginx/1.8.0
< Date: Wed, 18 May 2016 21:08:12 GMT
Date: Wed, 18 May 2016 21:08:12 GMT
< Content-Type: application/json;charset=UTF-8
Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Connection: keep-alive
Connection: keep-alive
<
{
"status" : 415,
"message" : "Content type 'application/x-www-form-urlencoded' not supported"
* STATE: PERFORM => DONE handle 0x600057830; line 1652 (connection #0)
* Curl_done
* Connection #0 to host api.everbridge.net left intact
}
Echo with new script suggested by Mircea
$ ./Send_Not.sh
curl -vvv --include --header 'Accept:application/json' --header 'Authorization:Basic xxxxxxxxxxxxxxxxx' -X POST --data '{"sourceTemplateId":111111111111111}' --header Content-Type:application/json https://api.everbridge.net/rest/notifications/000000000000000
Reply when I execute new script
$ ./Send_Not.sh
Note: Unnecessary use of -X or --request, POST is already inferred.
* STATE: INIT => CONNECT handle 0x600057830; line 1108 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* Trying 54.193.84.167...
* STATE: CONNECT => WAITCONNECT handle 0x600057830; line 1161 (connection #0)
* Connected to api.everbridge.net (54.193.84.167) port 443 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x600057830; line 1260 (connection #0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:#STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x600057830; line 1274 (connection #0)
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-SHA
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; ST=California; L=Glendale; O=Everbridge; OU=SaaS Operations; CN=*.everbridge.net
* start date: Sep 18 00:00:00 2015 GMT
* expire date: Sep 17 23:59:59 2018 GMT
* subjectAltName: host "api.everbridge.net" matched cert's "*.everbridge.net"
* issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust SSL CA - G3
* SSL certificate verify ok.
* STATE: PROTOCONNECT => DO handle 0x600057830; line 1295 (connection #0)
> POST /rest/notifications/000000000000000 HTTP/1.1
> Host: api.everbridge.net
> User-Agent: curl/7.48.0
> Accept: */*
> 'Accept:application/json'
> 'Authorization:Basic xxxxxxxxxxxxxxxxx'
> Content-Type:application/json
> Content-Length: 39
>
* upload completely sent off: 39 out of 39 bytes
* STATE: DO => DO_DONE handle 0x600057830; line 1357 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x600057830; line 1484 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x600057830; line 1494 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 400 Bad Request
HTTP/1.1 400 Bad Request
* Server nginx/1.8.0 is not blacklisted
< Server: nginx/1.8.0
Server: nginx/1.8.0
< Date: Wed, 18 May 2016 21:41:01 GMT
Date: Wed, 18 May 2016 21:41:01 GMT
< Content-Type: application/json;charset=UTF-8
Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Connection: keep-alive
Connection: keep-alive
<
{
"status" : 400,
"message" : "Error Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.tools.ant.filters.StringInputStream#5d5906fc; line: 1, column: 2] parsing input:\n'{\"sourceTemplateId\":111111111111111}'"
* STATE: PERFORM => DONE handle 0x600057830; line 1652 (connection #0)
* Curl_done
* Connection #0 to host api.everbridge.net left intact
}
I also escaped the double quotes for Conten-Type, and I got the original error
#!/bin/bash
ajson="Accept:application/json"
credentials="Authorization:Basic xxxx_replace_xxxx"
data='{"sourceTemplateId":111111111111111}'
CT=\"Content-Type:application/json\"
url="https://api.everbridge.net/rest/notifications/000000000000000"
curl -vvv --include --header "$ajson" --header "$credentials" --data "$data" --header "$CT" "$url"
Original error when executed
$ ./Send_Not.sh
Note: Unnecessary use of -X or --request, POST is already inferred.
* STATE: INIT => CONNECT handle 0x600057830; line 1108 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* Trying 54.193.84.167...
* STATE: CONNECT => WAITCONNECT handle 0x600057830; line 1161 (connection #0)
* Connected to api.everbridge.net (54.193.84.167) port 443 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x600057830; line 1260 (connection #0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:#STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x600057830; line 1274 (connection #0)
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-SHA
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; ST=California; L=Glendale; O=Everbridge; OU=SaaS Operations; CN=*.everbridge.net
* start date: Sep 18 00:00:00 2015 GMT
* expire date: Sep 17 23:59:59 2018 GMT
* subjectAltName: host "api.everbridge.net" matched cert's "*.everbridge.net"
* issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust SSL CA - G3
* SSL certificate verify ok.
* STATE: PROTOCONNECT => DO handle 0x600057830; line 1295 (connection #0)
> POST /rest/notifications/000000000000000 HTTP/1.1
> Host: api.everbridge.net
> User-Agent: curl/7.48.0
> Accept: */*
> 'Accept:application/json'
> 'Authorization:Basic xxxxxxxxxxxxxxxxxx'
> "Content-Type:application/json"
> Content-Length: 39
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 39 out of 39 bytes
* STATE: DO => DO_DONE handle 0x600057830; line 1357 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x600057830; line 1484 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x600057830; line 1494 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 415 Unsupported Media Type
HTTP/1.1 415 Unsupported Media Type
* Server nginx/1.8.0 is not blacklisted
< Server: nginx/1.8.0
Server: nginx/1.8.0
< Date: Wed, 18 May 2016 21:48:54 GMT
Date: Wed, 18 May 2016 21:48:54 GMT
< Content-Type: application/json;charset=UTF-8
Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Connection: keep-alive
Connection: keep-alive
<
{
"status" : 415,
"message" : "Content type 'application/x-www-form-urlencoded' not supported"
* STATE: PERFORM => DONE handle 0x600057830; line 1652 (connection #0)
* Curl_done
* Connection #0 to host api.everbridge.net left intact
}
As stated in the comments this is an issue on how you are escaping things.
Here is a form of the script that works:
#!/bin/bash
ajson="Accept:application/json"
credentials="Authorization:Basic xxxx_replace_xxxx"
data='{"sourceTemplateId":111111111111111}'
CT="Content-Type:application/json"
url="https://api.everbridge.net/rest/notifications/000000000000000"
curl -vvv --include --header "$ajson" --header "$credentials" --data "$data" --header "$CT" "$url"

Openshift wordpress app: can't connect to mysql database

I have just set up an openshift wordpress application environment (http://eigenbouw-vanhove.rhcloud.com/) but i can't get a connection to the mysql database. I added the phpmyadmin cartridge and i think i set the right information in my wp-config.
The error i'm getting when surfing to the site:
Error establishing a database connection
My wp-config:
$EBmysql = getenv('OPENSHIFT_MYSQL_DB_URL');
$EBmysqlUser = getenv('OPENSHIFT_MYSQL_DB_USERNAME');
$EBmysqlPass = getenv('OPENSHIFT_MYSQL_DB_PASSWORD');
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'eigenbouw');
/** MySQL database username */
define('DB_USER', $EBmysqlUser);
/** MySQL database password */
define('DB_PASSWORD', $EBmysqlPass);
/** MySQL hostname */
define('DB_HOST', $EBmysql);
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
The log files don't contain any errors it seems:
==> mysql/log/mysql_start.log <==
140318 18:34:51 mysqld_safe Logging to '/var/lib/openshift/5328c0ca50044622b20002dc/mysql//log/mysql_error.log'.
140318 18:34:52 mysqld_safe Starting mysqld daemon with databases from /var/lib/openshift/5328c0ca50044622b20002dc/mysql/data/
==> mysql/log/mysql_error.log <==
140318 18:34:52 InnoDB: highest supported file format is Barracuda.
140318 18:34:52 InnoDB: Waiting for the background threads to start
140318 18:34:53 InnoDB: 5.5.36 started; log sequence number 2226531
140318 18:34:53 [Note] Server hostname (bind-address): '127.13.143.130'; port: 3306
140318 18:34:53 [Note] - '127.13.143.130' resolves to '127.13.143.130';
140318 18:34:53 [Note] Server socket created on IP: '127.13.143.130'.
140318 18:34:53 [Warning] 'proxies_priv' entry '# root#ex-std-node306.prod.rhcloud.com' ignored in --skip-name-resolve mode.
140318 18:34:53 [Note] Event Scheduler: Loaded 0 events
140318 18:34:53 [Note] /opt/rh/mysql55/root/usr/libexec/mysqld: ready for connections.
Version: '5.5.36' socket: '/var/lib/openshift/5328c0ca50044622b20002dc/mysql//socket/mysql.sock' port: 3306 MySQL Community Server (GPL)
==> mysql/log/install_db.log <==
See the manual for more instructions.
You can start the MySQL daemon with:
cd /opt/rh/mysql55/root/usr ; /opt/rh/mysql55/root/usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /opt/rh/mysql55/root/usr/mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
==> php/logs/access_log-20140318-000000-EST <==
178.116.245.86 - - [18/Mar/2014:18:13:15 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:15 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:22 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:24 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:26 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:29 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:35:42 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:35:44 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:35:45 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:36:25 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
==> php/logs/error_log-20140318-000000-EST <==
[Tue Mar 18 18:05:29 2014] [error] [client 127.13.143.129] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Tue Mar 18 18:05:30 2014] [error] [client 127.13.143.129] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Tue Mar 18 18:12:13 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c826
[Tue Mar 18 18:12:14 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Mar 18 18:12:14 2014] [notice] Digest: done
[Tue Mar 18 18:12:14 2014] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations
[Tue Mar 18 18:35:18 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c826
[Tue Mar 18 18:35:19 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Mar 18 18:35:19 2014] [notice] Digest: done
[Tue Mar 18 18:35:19 2014] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations
==> phpmyadmin/logs/access_log-20140318-000000-EST <==
178.116.245.86 - - [18/Mar/2014:18:35:52 -0400] "GET /phpmyadmin/themes/pmahomme/img/arrow_ltr.png HTTP/1.1" 200 139 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:35:53 -0400] "GET /phpmyadmin/db_structure.php?server=1&db=eigenbouw&token=abf8131a63f3f81249051839468aa0af&ajax_request=true&ajax_page_request=true&menuHashes=3a627a2c-d774b552-9e6d7974-08f204f8&_nocache=1395182166321431500 HTTP/1.1" 200 38411 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:03 -0400] "GET /phpmyadmin/sql.php?db=eigenbouw&token=abf8131a63f3f81249051839468aa0af&goto=db_structure.php&table=wp_posts&pos=0&ajax_request=true&ajax_page_request=true&menuHashes=3a627a2c-d774b552-9e6d7974-08f204f8&_nocache=1395182176714675967 HTTP/1.1" 200 148961 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/themes/pmahomme/img/s_fulltext.png HTTP/1.1" 200 193 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/js/get_scripts.js.php?scripts[]=tbl_structure.js&scripts[]=gis_data_editor.js HTTP/1.1" 200 31426 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/themes/pmahomme/img/col_pointer.png HTTP/1.1" 200 113 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/phpmyadmin.css.php?server=1&token=abf8131a63f3f81249051839468aa0af&nocache=5539948530ltr" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/themes/pmahomme/img/col_drop.png HTTP/1.1" 200 132 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/phpmyadmin.css.php?server=1&token=abf8131a63f3f81249051839468aa0af&nocache=5539948530ltr" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/index.php?ajax_request=1&recent_table=1&token=abf8131a63f3f81249051839468aa0af HTTP/1.1" 200 221 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:14 -0400] "GET /phpmyadmin/index.php?token=abf8131a63f3f81249051839468aa0af&ajax_request=true&ajax_page_request=true&menuHashes=3a627a2c-d774b552-9e6d7974-08f204f8-f835d310&_nocache=1395182187916183155 HTTP/1.1" 200 35246 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:15 -0400] "GET /phpmyadmin/version_check.php?&_nocache=1395182189038290343 HTTP/1.1" 200 39 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
==> phpmyadmin/logs/error_log-20140318-000000-EST <==
[Tue Mar 18 18:05:55 2014] [notice] Digest: done
[Tue Mar 18 18:05:55 2014] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured -- resuming normal operations
[Tue Mar 18 18:12:09 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c826
[Tue Mar 18 18:12:10 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Mar 18 18:12:10 2014] [notice] Digest: done
[Tue Mar 18 18:12:10 2014] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured -- resuming normal operations
[Tue Mar 18 18:35:14 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c826
[Tue Mar 18 18:35:15 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Mar 18 18:35:15 2014] [notice] Digest: done
[Tue Mar 18 18:35:15 2014] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured -- resuming normal operations
==> php/logs/access_log-20140318-000000-EST <==
178.116.245.86 - - [18/Mar/2014:18:37:49 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
Any ideas?
The db url is not going to work, you need to use getenv('OPENSHIFT_MYSQL_DB_HOST') instead, and use the getenv('OPENSHIFT_MYSQL_DB_PORT') also if you are using a scaled application.
if you ssh into your gear and run 'env | grep MYSQL' you will see that the URL variable is not what it should be for WordPress to connect to the database.
Here are the database define statements pulled 17 April 2015 from OpenShift's sample WordPress app:
define('DB_NAME', getenv('OPENSHIFT_APP_NAME'));
define('DB_USER', getenv('OPENSHIFT_MYSQL_DB_USERNAME'));
define('DB_PASSWORD', getenv('OPENSHIFT_MYSQL_DB_PASSWORD'));
define('DB_HOST', getenv('OPENSHIFT_MYSQL_DB_HOST') . ':' . getenv('OPENSHIFT_MYSQL_DB_PORT'));
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
The full wp-config.php file can be found on Github:
https://github.com/openshift/wordpress-example/blob/master/.openshift/config/wp-config.php