Hello Ruhi, to perform Zoom-in or Zoom-out actions on a webpage, you have to use transform CSS property which allows you to perform zoom in, zoom out, rotate or skew on a webpage. Checkout the following automation script to understand better:
from selenium import webdriver
from time import sleep
driver = webdriver.Firefox()
driver.get("https://www.youtube.com/")
timeout = 10
''' Zoom in by 150% '''
driver.execute_script('document.body.style.MozTransform = "scale(1.5)";')
driver.execute_script('document.body.style.MozTransformOrigin = "0 0";')
sleep(10)
''' Zoom out by 100% '''
driver.execute_script('document.body.style.MozTransform = "scale(1.0)";')
driver.execute_script('document.body.style.MozTransformOrigin = "0 0";')
sleep(10)
driver.quit()