How To Zoom In And Zoom Out Browser In Selenium WebDriver | Software Testing Material

How To Zoom In And Zoom Out In Selenium

We all know Selenium automates browsers. When we are running selenium scripts, sometimes we may face a situation where we need to perform zoom in and zoom out. In Selenium, this can be easily achieved. In this article, I will show you two methods on how to Zoom In and Zoom Out in Selenium WebDriver.

Manually, we have to press CTRL+ADD to do Zoom In and we have to press CTRL+SUBTRACT to do zoom out. I have tested both the below methods i.e., how to zoom in and zoom out on firefox.

How To Handle Zoom In And Zoom Out

Method 1: Using Robot Class

We can perform page zoom action using sendKeys method.

Method 2: Using SendKeys Method

Must Read: Selenium Complete Tutorial

Read More:

Get our latest blog posts delivered to your inbox

Subscribe and get popular blog posts about software testing industry.


7 thoughts on “How To Zoom In And Zoom Out Browser In Selenium WebDriver | Software Testing Material”

  1. Thanks Raj for your inputs. I will try at my end and will get back to you for any issues.

    Thank you so much.

    • Hey hi Raj,

      Thank you for the solution and its working fine for me.

      Thank you so much!!

      • Hi Raj,

        Would like to share an observation for Method 2 code. I tried using SendKeys() method, but no change is seen on the screen. i have also put thread.sleep() to see the changes but nothing is seen.

        • I agree with you Saili Inamdar. Good observation. Sometimes in some applications it wont work. We could use any of the two methods.

      • Nice to hear that it worked for you.

        • Thank you!! 🙂

  2. Robot class worked thanks 🙂

Leave a Comment

Share via
Copy link
Powered by Social Snap