How can i provide language of browser where automated test runs - windows

Help me please.
My windows is not english, but my chrome language is english. The problem is when i automate tests and selenium browser window is open, the language of my selenium window matches to my windows language but not to my chrome language.
For example: when selenium chrome window is shown and machine types values to the field with suggestion drop down menu. The listed items in the dropdown displayed in my windows language not english.
How can i resolve this proble? Thanks!

ChromeOptions Provide a way to set the language preferences
Here is an example code in java:-
ChromeOptions opt = new ChromeOptions();
//set language to Spanish
opt.addArguments("−−lang=es");
// configure options parameter to Chrome driver
WebDriver driver = new ChromeDriver(opt);
driver.manage().timeouts().implicitlyWait(8, TimeUnit.SECONDS);
driver.get("https://www.google.com/ ");

Related

How to switch from elements tab to network tab in selenium webdriver using '--auto-open-devtools-for-tabs'?

I have used '--auto-open-devtools-for-tabs' to open developers console while running selenium automation. By default its opening in Elements tab.I want to switch to Network tab or console tab. Is there any way to do it ?
devtools:
preferences:
panel-selectedTab: '"network"'
This worked Thanks to #wOxxOm

How to select the device to cast from popup in capybara, selenium, Ruby in chrome

I am trying to select the first device from popup to cast using selenium, capybara but I am not able to do it. Please find the popup below
I have tried following and it does not seem to be working
popup = page.driver.browser.window_handles.last
page.driver.browser.switch_to.window(popup)
page.driver.browser.switch_to.alert.accept
page.driver.browser.switch_to.alert.dismiss
page.driver.browser.switch_to.alert.text
Please provide sugggestions!
You can't - that's a system dialog and selenium can't interact with it once opened. It MAY be possible to set a default to launch and prevent the dialog from opening via chrome command line switches but I'm afraid I don't know what that would be.

why doesn't selenium focus work?

I am using Selenium 2.40.0 jar and Firefox 27.0 to test my web application.
I am facing the issue while focusing on specific element since onstart the focus is not on Firefox window. how do I get the focus on Firefox window for focus element to work?
Thanks for the help!
I hope using
driver.manage().window.maximize();
will set the focus on window by default.
Edit :
With Selenium RC you can try these two more functions (Any of these should work)
selenium.windowFocus();
selenium.selectWindow(windowID or windowName);
To get the window ID and names at run time you can use these functions :
selenium.getAllWindowIds();
selenium.getAllWindowNames();
These will return an array of IDs and Names of all opened broswer windows via selenium.You have to select as per your need.
On top of all this I would recommend you to use Selenium Webdriver in place of Selenium RC if possible as selenium RC is now depricated. The above given function driver.manage().window.maximize(); is for Webdriver only. Using webdriver you can avoid these small issues easily.
Migrating from Selenium RC to Selenium Webdriver

Firefox about:config preferences in SWT Browser

An application I am currently working on uses the SWT tool-kit's Browser widget to display a Firefox/XULRunner browser. I would like to set custom user agent data in Firefox about:config preferences; how does one alter them when working with SWT browsers?
I don't really work with the SWT browser, but http://dev.eclipse.org/mhonarc/lists/platform-swt-dev/msg06747.html seems to indicate there at least used to be an about:config in the SWT browser. Did you try it? What happened?
Also the SWT browser should have a profile named "eclipse" by default (it seems it's located at C:\Documents and Settings\<user name>\Application Data\Mozilla\eclipse\, see mozilla support for more info about profiles.
You should be able to edit prefs.js in there to set your preferences.

Is there any browser (Chrome, Firefox) plugin that allows to simulate geo location?

I need to test web application that extensively uses geo location api (getCurrentPosition, watchPosition). Is there any browser (Chrome, Firefox) plugin that allows to simulate geo location?
I am a bit late, but Microsoft Edge has this useful tab Emulation.
You can open this developer tool as usual hitting F12 button or by clicking on the browser's menu button, Developer Tools F12.
Geolocation:
Simulate a GPS receiver and enter GPS coordinates to test location-aware features in a webpage.
More info here at developer.microsoft.com
If I understood the question correctly and you're asking for a way to fake geolocation responses for your web app, you might be able to do this in Firefox by overriding the geo.wifi.uri in the prefs, like Firefox's unit tests do. See:
http://mxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/geolocation/geolocation_common.js?force=1
http://mxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/geolocation/network_geolocation.sjs?force=1 - the httpd.js script responding to requests of the geo.wifi.uri used in the tests.
Chromium 52 has it in-built:
Open developer console
Click the : button on the right, select More tools -> Sensors
In Tab "Sensors" you can modify the current location:

Resources