How to Zoom in and Out the webpage content
Hello,
I have the following code to set my browser capabilities. I would like to add Zoom in to set the browser to 100%. The reason I ask is when I run in my local some objects are working fine, but in my selenium grid the page zoom is set to 60% or so. And my tests are failing. I am think that could be because of this zoom setting.
var capabilities = {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [
"--headless",
"--window-size=1920,1080",
"--disable-gpu",
"--disable-dev-shm-usage",
"--no-sandbox"
]
}
}
Browsers.RemoteItem(server, capabilities).Run(url);
And want to use this following code or something similar, but not sure how to use it.
var scaleX = "1";
var scaleY = "1";
var js = document.body.style.transform='scale(scaleX, scaleY)';
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(js);
Thanks