'python selenium browser zoom in with shortcut (ctrl + '+') problem
trying to zoom in in an automated browser but i can't perform it
tried this:
self.action.key_down(Keys.CONTROL).send_keys(Keys.ADD).key_up(Keys.CONTROL).perform()
didn't work
tried this:
self.bot.find_element_by_tag_name('html').send_keys(Keys.CONTROL)
self.bot.find_element_by_tag_name('html').send_keys(Keys.ADD)
didn't work too tried this:
self.bot.execute_script("document.body.style.zoom='150%'")
didn't work as well
can someone help?
Solution 1:[1]
Not sure if it helps as you specifically asked about zooming using Keyboard inputs. I also could not work out why this doesn't work, even when using action chains with specific key_down and key_up commands it wouldn't work. However I did find a useful Javascript command that can act as a work around.
self.driver.execute_script("document.body.style.zoom='150%'")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marko Delic |
