is there any other way to set Zoom level of browser?driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
This is working fine with Firefox webdriver. But It's not working with Chrome. It throws the following Exceptionorg.openqa.selenium.WebDriverException: unknown error: cannot focus element (Session info: chrome=28.0.1500.71) (Driver info: chromedriver=2.3,platform=Linux 3.5.0-30-generic x86) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 53 milliseconds Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:15:02' System info: host: 'vtiger-desktop', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'i386', os.version: '3.5.0-30-generic', java.version: '1.7.0_12-ea' Session ID: 918da5187e72caa1e68c49614c187dee Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={chromedriverVersion=2.3}, rotatable=false, locationContextEnabled=true, version=28.0.1500.71, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268) at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89)
--
You received this message because you are subscribed to the Google Groups "ChromeDriver Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromedriver-us...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks for your quick response. I have tried with body also, thats not working. but I found a workaround using Robot class in java.
Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_MINUS); robot.keyRelease(KeyEvent.VK_CONTROL); robot.keyRelease(KeyEvent.VK_MINUS);It can zoom out the browser. But After Zoom out the browser with Robot class, Chrome webdriver is not working as expected. when it is supposed to click on an element, neither it is clicking the element nor throwing any exception.But its clicking on some other element instead. Can any one explain why it happens
As you said, we may achieve zoom out by setting the preferences of Chrome Webdriver for default zoom level. if it is possible, Please provide the property name of the Default Zoom level to set preference.
To unsubscribe from this group and stop receiving emails from it, send an email to chromedriver-users+unsub...@googlegroups.com.
Yes, exactly you got my point.
Actual Problem with display settings in Machine, not with WebPage or browser. I am using Ubuntu 12.10. In Display Settings, size can be set with one option among five options ( 1024x768, 800x600, 848x480, 640x480 , disabled) only. But monitor required size(1366x768) is bigger than available sizes. If size set to 1024x768, screen looks like zoom in with 110%. So browser also displays the web page like a zoom with 110% but browser level zoom is 100% only . If we want to the see the web page normally we can set zoom 90% in browser level ( this can be done by using CTRL + MINUS). So if we set browser default zoom level to 90%, we can see all web pages normally. Thats why I zooming out the browser in automation. (this can be done in firefox webdriver but not in chrome webdriver)My actual problem is not related to chrome Webdriver. But I feel that zoom is also one of the preferable feature to be supported by chrome web driver.
Thank you for quick responses.Sorry for my English.
Interesting. Really, a horizontal scrollbar should appear that lets the user scroll right. Seems either the website or Chrome is broken.Regardless, see "Set A Chrome Preference" at https://sites.google.com/a/chromium.org/chromedriver/capabilitiesYou'll want to set the "profile.per_host_zoom_levels.<yourdomainname>" pref to .8 or something to achieve your desired zoom.
KenOn Thu, Nov 21, 2013 at 11:16 PM, Gangadhar Perineedi <perineedi...@gmail.com> wrote:
Again I am mentioning that This is the issue related to Display&Monitor settings in Machine, not with the Chrome browser. You can reproduce it by reducing the resolution size in display Settings of Your Machine, then your Monitor looks like in zoom. So that your browser also displays the Page with zoom.When I open the webPage in browser, It displays the web page as like in screenshot1 SamplePage.png.After Zooming out the page with 90% using CTRL + MINUS, Page will be displayed as like in screenshot2 SamplePageWithZoom90.png. You can see " + " image in screenshot2 only and you can't see that in the screenshot1.
Hey,
Use this if working on chrome
driver.execute_script("document.body.style.zoom='67%'")
This works for chrome and not for firefox.