Srikanth Ch
Srikanth Ch

Reputation: 13

How to set zoom levels in chrome browser using watir webdriver(ruby watir- set specific zoom level / zoom out /zoom in)

I didn't get to know how to set the browser capabilities in watir, so got this online and tried the following but it didn't work for me.

My problem is, i was suppose to reduce the zoom level to 75% and do the rest of the coding:

driver = Watir::Browser.new :chrome
driver.send_keys [:control, :subtract]*3

Upvotes: 0

Views: 546

Answers (1)

Rajagopalan
Rajagopalan

Reputation: 6064

It's common notion that when people use selenium,they tend to use driver variable, but when people use WATIR they use browser, so use browser instead of driver.

And to answer your question, you can use the following code to set up your zoom level.

browser=Watir::Browser.new :chrome
browser.execute_script("document.body.style.zoom='75%'")

Upvotes: 1

Related Questions