I am facing an issue with my test setup where the selenium web-driver window that opens appears to be too small. This is causing problems as some elements that I need to interact with are hidden in menus due to the browser size. I would like to find a way to make sure the browser opens completely for all my tests.
One possible solution I am considering is to adjust the browser size so that it fills the entire screen during the tests. Here is the code snippet I have in mind:
import { After, AfterAll, Status } from '@cucumber/cucumber';
import { Builder, Capabilities } from 'selenium-webdriver';
require('chromedriver');
// driver setup
const capabilities = Capabilities.chrome();
capabilities.set('chromeOptions', { w3c: false });
export const driver = new Builder().withCapabilities(capabilities).build();
After(function (scenario) {
if (scenario.result.status === Status.FAILED) {
return driver.takeScreenshot().then(screenShot => {
this.attach(screenShot, 'image/png');
});
}
});
AfterAll(async () => await driver.quit());