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, 2020 in Selenium by Jyra
• 580 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, 2020 by Jake

selected Apr 11, 2020 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, 2020 by Jamal Mohammed

Related Questions In Selenium

0 votes
2 answers

How to Validate the real time application for which the input will be refreshed for every 4 s in the UI screen?

Hi, @Savitha, It can be achieved, just ask ...READ MORE

answered Nov 20, 2020 in Selenium by anonymous
• 65,910 points
0 votes
0 answers
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,500 points
0 votes
2 answers

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

JavascriptExecutor jsx = (JavascriptExecutor)driver; jsx.executeScript("window.scrollBy(0,555)", ""); or Action classes ...READ MORE

answered Sep 6, 2020 in Selenium by Sri
• 3,190 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 21, 2018 in Selenium by king_kenny
• 3,710 points
0 votes
2 answers

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,500 points
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
0 votes
2 answers

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

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

answered Sep 4, 2020 in Selenium by Sri
• 3,190 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,910 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP