Chrome set browser zoom?

Is there a way to set browser zoom when executing? When I am on my laptop the elements cover themselves and are not clickable. If I zoom out to 80% it can see them. I’d rather not send keys with ctrl - as this is only needed on my laptop and I like to avoid send keys.

Is there a way to choose default zoom when executing in chrome? If I set my browser to 80% katalon always runs it at 100% anyway.

What do you mean by “elements cover themselves”. Do you get the scroll bar? And element appear only on use of scroll bar?

It tells me the object is not clickable. It’s the coding in the background, visually you can see the elements separate. On a code level they are overlapping and one is actually behind the other.

hello,
try this trick:

WebUI.executeJavaScript("document.body.style.zoom='XY%'", null)

*** edited thanx to @disover katalon

1 Like

Andrej Podhajský said:

hello,
try this trick:

WebUI.executeJavaScript("document.body.style.zoom='zoom 60%'", null)

  

Thanks Andrej … This works …

WebUI.executeJavaScript(“document.body.style.zoom=‘60%’”, null)

Hi Andrej,

I am facing same issue as B_L

It tells me the object is not clickable. It’s the coding in the background, visually you can see the elements separate. On a code level they are overlapping and one is actually behind the other

Can you please help me out.

Here is code snippet I use for Chrome. This will default your zoom at startup based on the chrome settings, so no css.
//extra imports
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.Keys as Keys
import org.openqa.selenium.JavascriptExecutor

WebUI.openBrowser(’’)
WebUI.maximizeWindow()

WebDriver driver = DriverFactory.webDriver

driver.get(“https://learnautomatedtesting.com”)
//before
WebUI.delay(20)
driver.manage().window().setSize(new Dimension(1920, 1200))

//go to the chrome settings
driver.get(“chrome://settings/”)

//set the zoom to 70%
((JavascriptExecutor)driver).executeScript(“chrome.settingsPrivate.setDefaultZoom(0.7);”);

WebUI.navigateToUrl(‘https://learnautomatedtesting.com’)

//after
WebUI.delay(20)

good luck