Reputation: 131
Issue : window-size in chrome option not working in headless chrome in protractor running inside docker.
Setup:
chromedriver version : 2.33 as used by protractor 5.3.1
Dockerfile :
FROM node:9-alpine
RUN echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
&& apk add --no-cache \
python \
build-base \
git \
bash \
openjdk8-jre-base \
# chromium dependencies
nss@edge \
chromium-chromedriver@edge \
chromium@edge
Protractor.conf.js :
chromeDriver: '/usr/bin/chromedriver',
directConnect: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
args: ['no-sandbox','headless','window-size=1366,768'],
Same setting works in local without docker environment.
Error : Chrome opens up but testcase fail (doesnt attempt to reach app url)
UnhandledPromiseRejectionWarning: WebDriverError: no such session
Tried 1:
'window-size=1366,768'
'window-size=1366x768'
'--window-size=1366x768'
'screen-size=1366x768'
Tried 2 :
onPrepare: function () {
browser.driver.manage().window().setSize(1280, 1440);
}
This also dint workout with chrome opening in default window size.
Tried 3 :
tried updating protractor to [email protected] (was at 5.1) and using
'goog:chroomeOptions' : {
args: ['no-sandbox','headless','window-size=1366,768'],
}
Can someone point out whats issue . Thanks
Upvotes: 0
Views: 1672
Reputation: 131
It was a memory issue .
--shm-size=1gb
resolved it .
Thanks to @sylvaindumont for providing the solution.
Upvotes: 1
Reputation: 4264
Try using the --start-maximized
chrome options in chromeoptions
. I have this problem once and adding this flag resolved this problem.
Upvotes: 0