#SELENIUM, CHROMEOPTIONS - CAn we do one time set up for page zoom which applies for alll pages in the application

+1 vote
Problem Statement :
THe application for which I am executing the selenium script, takes different resolution in different machines like laoptop, Desktop etc. Could someone please tell a solution,  if there is one time setup that we can do in the automation script once the chromedriver starts. Something like chromeoptions

I tried below methods:
- Created a zoominZoomout method, which executed javascript executor and sets the zoom. I dont want to use this becasue i have to call this method whereever it is needed while navigating to a new page. if the same code is executed in other' system, this may fail.

- Created method with key control, i have to follow the same callings as trial1.
Apr 3 in Selenium by Jyra
• 490 points
You can create function with defined resolutions and call that when you want to execute script

2 answers to this question.

+3 votes
Best answer

Have you tried using the Keys.chord() method:

WebElement html = driver.findElement(By.tagName("html"));
html.sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD));
answered Apr 3 by Jake

selected Apr 11 by Jyra
+1 vote
Use javascript executor for one time resolutions detection.

Use below code inside it

window.screen.width * window.devicePixelRatio and window.screen.height * window.devicePixelRatio.
answered Apr 6 by Jamal Mohammed

Related Questions In Selenium

0 votes
1 answer

How do I set the zoom level of Internet Explorer to 100% when using python _winreg

My qustion is, by default for testing ...READ MORE

answered Mar 30, 2018 in Selenium by nsv999
• 5,510 points
0 votes
1 answer

How to scroll the Page up or down in Selenium WebDriver? (using java)

Its pretty simple. Check out the below ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,510 points
+4 votes
2 answers

Can we get the HTTP Response Code in Selenium with Java?

It is indeed possible to get http ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,710 points
0 votes
1 answer

Can we control the test execution speed in WebDriver (using Ruby)

The methods controlling execution speed in WebDriver ...READ MORE

answered May 30, 2018 in Selenium by king_kenny
• 3,710 points
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
0 votes
1 answer
0 votes
1 answer

What is the role of TestNG & JUnit frameworks in Selenium?

Well TestNG and JUnit are test frameworks ...READ MORE

answered Apr 18, 2018 in Selenium by king_kenny
• 3,710 points
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,870 points