Can we Zoom the browser window in python selenium webdriver?

后端 未结 5 731
不思量自难忘°
不思量自难忘° 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:52

    I was just struggling with this. I managed to find something that works for me, hopefully it works for you:

    driver.execute_script("document.body.style.zoom='zoom %'")
    

    Have 'zoom%' = whatever zoom level you want. (e.g. '67%')

提交回复
热议问题