Issue
I found this for java :-
WebElement html = driver.findElement(By.tagName("html"));
html.sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD));
But how to do this using Python? I want to zoom out one level after get requests.
Solution
You can do something similar where you specify the zoom levels as below:
For example, if my body
has a <div id='values'>
, I could zoom the div using
from selenium import webdriver
def main():
browser = webdriver.Chrome()
browser.set_window_size(1000, 1000)
browser.get("http://yoursite.com")
browser.execute_script("$('#values').css('zoom', 5);")
if __name__ == '__main__':
main()
Or Simply try:
driver.execute_script("document.body.style.zoom='zoom %'")
Answered By - Vaulstein
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.