Use the hermione-hide-scrollbars
plugin to hide scrollbars in tests that run in Chrome browsers.
To access the browser via Chrome DevTools Protocol (CDP), the plugin uses the puppeteer-core package.
To hide scroll bars, the CDP Emulation.setScrollbarsHidden command is used.
Update your Chrome browser to version 109.0 and higher so that this functionality works in your tests.
To use chrome browsers versions from 72.1 (inclusive) to 109.0 (not inclusive), use [email protected].
Earlier versions of Chrome browsers do not support the Emulation.setScrollbarsHidden command.
npm install -D hermione-hide-scrollbars
Add the plugin to the plugins
section of the hermione
config:
module.exports = {
plugins: {
'hermione-hide-scrollbars': {
enabled: true,
browsers: ['chrome'],
browserWSEndpoint: ({ sessionId, gridUrl }) => `ws://${url.parse(gridUrl).host}/devtools/${sessionId}`
},
// other hermione plugins...
},
// other hermione settings...
};
Parameter | Type | Default value | Description |
---|---|---|---|
enabled | Boolean | true | Enable / disable the plugin. |
browsers | Array | [ ] |
A list of browsers for which the logic of disabling scroll bars will be applied. |
browserWSEndpoint | Function | N/A | A function that should return the URL to work with the browser via CDP. To be able to define the URL, the session ID and a link to the grid are passed to the function: the parameters are passed as an object with the keys sessionId and gridUrl. |
All plugin parameters that can be defined in the config can also be passed as command-line options or through environment variables during the launch of Hermione. Use the prefix --hide-scrollbars-
for command line options and hermione_hide_scrollbars_
for environment variables.