I m trying to set my browser screen with resolution of (360,640) but when i m reading, it is changed in value and there is a difference in set values and get values
resolution(){
browser.manage().window().setSize(360,640);
browser.manage().window().getSize().then((getSize) => {
console.log('Value of Height', getSize.height);
console.log('Value of width', getSize.width);
});
}
NOTE :: tried with different resolution and their result as below:
1.Width :: 360 and Height :: 640
Result is coming as Width:: 516 and Height :: 640
2.Width ::768 and Height :: 1024
Result is coming as Width :: 768 and Height :: 788
Using Protractor Version :: Version 5.4.3
npm :: 6.14.5
Please help me out to solve this problem
Can you try setting the resolution on capabilities instead of creating a resolution function for it. Like this:
capabilities: {
'browserName': 'chrome',
chromeOptions: {
args: [ "--headless", "--disable-gpu", "--window-size=1440,960"]
},
}
Also alternately you can add the browser.window setSize inside your onPrepare function like this:
onPrepare: async() => {
browser.baseUrl = 'https://app.thegaas.com';
await browser.driver.manage().window().setPosition(0,0);
await browser.driver.manage().window().setSize(1440,960);
let getSize = await browser.driver.manage().window().getSize();
console.log('Value of Height', getSize.height);
console.log('Value of width', getSize.width);
}
You can remove the async await and resolve the promises using .then instead.