Can we Zoom the browser window in python selenium webdriver?

后端 未结 5 739
不思量自难忘°
不思量自难忘° 2020-12-14 10:52

I am trying to ZOOM IN and ZOOM OUT the Chrome( selenium webdriver) only using keyboard. I have tried --

from selenium.webdriver.common.keys import Keys
driv         


        
5条回答
  •  没有蜡笔的小新
    2020-12-14 11:35

    firefox solution for me,

    Zoom body browser

    zoom is a non-standard property, use transform instead (demo):

    driver.execute_script("document.body.style.transform = 'scale(0.8)'")

    https://github.com/SeleniumHQ/selenium/issues/4244

    driver.execute_script('document.body.style.MozTransform = "scale(0.50)";')

    driver.execute_script('document.body.style.MozTransformOrigin = "0 0";')

提交回复
热议问题