I'm using the protractor instructions to establish that I can use my headless browsers.
So as per instructions...
conf.js
exports.config = {
seleniumAddress: 'http://seleniumhub:4444/wd/hub',
multiCapabilities: [
{
browserName: 'firefox',
'moz:firefoxOptions': {
args: [
"--headless",
]
}
},
{
browserName: 'chrome',
chromeOptions: {
args: [
// chrome will crash without this
'--headless',
"--disable-gpu",
]
}
}
],
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
},
specs: ['todo-spec.js']
};
todo-spec.js
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
From within my node 8.8.1 container I run
./node_modules/.bin/protractor conf.js
Standard stuff really and really vanilla as I wanted to find what the culprit is.
When the tests run firefox passes and chrome fails with
E/protractor - Could not find Angular on page https://angularjs.org/ : retries looking for angular exceeded
Any clues / ideas / suggestions?
My "seleniumhub" is a dockerised selenium grid with a firefox and a chrome node. Everything is on version 3.6.0.
To sum up the versions...
- Node 8.8.1 (docker)
- Selenium Hub 3.6.0 (docker)
- Selenium Chrome Node 3.6.0 (docker)
- Selenium Firefox Node 3.6.0 (docker)
- Protractor 5.2.0
Also here's my docker-compose.yml
version: "3.2"
services:
seleniumhub:
image: selenium/hub:${SELENIUM_VERSION}
networks:
- private
ports:
- 4444:4444
environment:
# As integer, maps to "maxSession"
GRID_MAX_SESSION: 10
# In milliseconds, maps to "newSessionWaitTimeout"
GRID_NEW_SESSION_WAIT_TIMEOUT: -1
# As a boolean, maps to "throwOnCapabilityNotPresent"
GRID_THROW_ON_CAPABILITY_NOT_PRESENT: 'true'
# As an integer
GRID_JETTY_MAX_THREADS: -1
# In milliseconds, maps to "cleanUpCycle"
GRID_CLEAN_UP_CYCLE: 5000
# In seconds, maps to "browserTimeout"
GRID_BROWSER_TIMEOUT: 0
# In seconds, maps to "timeout"
GRID_TIMEOUT: 30
# Debug
GRID_DEBUG: 'false'
depends_on:
- webserver
firefoxnode:
image: selenium/node-firefox${SELENIUM_DEBUG}:${SELENIUM_VERSION}
networks:
- private
volumes:
- /dev/urandom:/dev/random
- .:/tmp/app:cached
depends_on:
- seleniumhub
environment:
HUB_PORT_4444_TCP_ADDR: seleniumhub
HUB_PORT_4444_TCP_PORT: 4444
# https://stackguides.com/questions/13723349/selenium-grid-maxsessions-vs-maxinstances
NODE_MAX_SESSION: 10
NODE_MAX_INSTANCES: 10
chromenode:
image: selenium/node-chrome${SELENIUM_DEBUG}:${SELENIUM_VERSION}
networks:
- private
volumes:
- /dev/urandom:/dev/random:ro
- /dev/shm:/dev/shm:ro
- .:/tmp/app:cached
depends_on:
- seleniumhub
environment:
HUB_PORT_4444_TCP_ADDR: seleniumhub
HUB_PORT_4444_TCP_PORT: 4444
# https://stackguides.com/questions/13723349/selenium-grid-maxsessions-vs-maxinstances
NODE_MAX_SESSION: 10
NODE_MAX_INSTANCES: 10
node:
depends_on:
- seleniumhub
Many thanks in advance