Docker + Selenium Grid: Is it possible to do true cross-platform testing? - selenium

I am new to Docker and I am exploring Docker as a way to build a more stable and maintainable Selenium GRID. I have completed the Docker + Selenium Grid course at Udemy, but I still don't know a few things.
My company has a web portal and I am required to verify functionality across browers and OSes:
Recent versions of Chrome on recent versions of Mac, Linux & Windows
Recent versions of Firefox on recent versions of Mac, Linus & Windows
Recent versions of Safari on Mac
Recent versions of IE and Edge on recent versions of Windows
As far as I can tell a Docker container is 'linux-like'. Does that mean it serves only to verify Chrome and Firefox on linux. Is there some way to use Docker to verify these other browser + OS combos?

Please explore the below projects for selenium grid with docker on Linux and Windows .
1)https://github.com/elgalu/docker-selenium/blob/master/README.md
2)https://github.com/SeleniumHQ/docker-selenium
3)https://github.com/zalando/zalenium/blob/master/docs/usage_examples.md
Recent versions of Safari on Mac
-: I am not sure about the safari availability in docker hub , but try putting your question for mac in docker-for-selenium project they will help you .
Recent versions of IE and Edge on recent versions of Windows
-:Yes , their are some challenges while implementing the IE and Edge in windows containers.
please check this thread #https://github.com/MicrosoftDocs/Virtualization-Documentation/issues/214
it is clearly mentioned here , "Windows feature enabling to install the GUI within a windows container" ,So challenges are their to enable GUI for windows container .
But still if you want to go for cross browser testing
with other options available for windows . you can try exploring this # https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
UPDATES
Copying my answer from https://stackoverflow.com/a/55704955/5449500
Still there is no official approach to run IE/EDGE inside docker as
"No Windows docker images have GUI, so we cannot test IE11, EDGE."
But,We can install virtual-box and make this happen.
This approach adds extra layer of virtualization[Nesting of virtualization] on the top of docker to make the IE/Edge execution happen and I think in near future it may leads to to performance issue for heavy testing.
If Selenium testing is what you are looking for and don't have heavy load , you can give a try to the approach mentioned in the link.
Youtube - Selenium Windows containers in Docker under Linux
Github - Windows Images
Blogpost - selenium-on-windows-docker-revolution

Related

Firefox spontaneous launch in Selenium

Environment:
selenium-server-standalone-3.8.1.jar
geckodriver-v0.24.0
firefox 60.6.1
Everything was set up 6 months ago and everything worked well, the tests passed through the Selenium and there were no problems.
Since 08/23/2019 problems began. Without any launches test inside the Selenium process, started to run spontaneously browsers (firefox) and did not turn off.
These processes overload the processor on the server, after which the server starts to brake and also the site that is on the server. These "browser launches" continue until Selenium is reloaded by open browsers after which our automatic tests are blocked and display an error: "unable to create new native thread".
As soon as one such browser spontaneously opens, the processor load becomes 100%.
These browser launches occur approximately 1 time in 4-5 minutes.
All tests are disabled, but Selenium lives its own life, and continues to launch the browsers.
Maybe someone faced a similar problem? Any ideas why this is happening and how to fix it?
The launch of selenium occurs on command:
su screener -c "/usr/bin/java -Dwebdriver.gecko.driver=/usr/local/bin/geckodriver -jar /usr/lib/selenium/selenium-server-standalone-3.8.1.jar -enablePassThrough false -port 4444 >/var/log/selenium/selenium_std.log 2>/var/log/selenium/selenium_error.log &"
Term yourself lucky to have sailed smoothly with geckodriver-v0.24.0 and selenium-server-standalone-3.8.1.jar till 08/23/2019.
As per the documentation:
To work with geckodriver-v0.24.0 you need:
Selenium Python client version greater then 3.14
Firefox client version minimum 57 (which seems to be okay)
You can find the detailed GeckoDriver, Selenium and Firefox Browser compatibility chart in the discussion Which Firefox browser versions supported for given Geckodriver version?
Additional considerations
As a part of the best practices:
Upgrade JDK to recent levels JDK 8u222.
Upgrade Selenium to current levels Version 3.141.59.
Upgrade GeckoDriver to GeckoDriver v0.24.0 level.
GeckoDriver is present in the desired location.
GeckoDriver is having executable permission for non-root users.
Upgrade Firefox version to Firefox v65.0.2 levels.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
http://www.yourownlinux.com/2013/10/how-to-free-up-release-unused-cached-memory-in-linux.html) before and after the execution of your Test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your Test as a non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
You can find a detailed discussion in PhantomJS web driver stays in memory
If the stale WebDriver instances still persist you may require to forcefully remove them.
You can find a detailed discussion in Selenium : How to stop geckodriver process impacting PC memory, without calling driver.quit()?
Outro
Limit chrome headless CPU and memory usage

Running ie10, ie11 at same time for testing?

I recently installed ie11 on my Windows7 machine and do browser testing for all versions of ie on it in the document. I also do tests on Browserstack. I have client now that INSISTS I test on ie10 directly.
As you know, Windows won't let you run multiple version if ie, un-install ie directly, or reinstall an older version when a newer version is already installed. I don't want to have to uninstall/reinstall ie11, reinstall/install ie10.
Is there a work around where I can run both version without have to uninstall one or the other?
On modern.ie you can find free virtual machines for every version of Internet Explorer.
Press F12 and you can go backward to previous versions of IE (click on browser mode). First go to the website and then change browser mode (the opposite order won't work)

Selenium not working in firefox 23.0.1 (Mac and Windows)

I have a client who had a script working and now stopped working. I run it in my computer and it works (i runned it on Linux and Windows). My client runned it on Mac and Windows.
I am new to Selenium, but the part of the code that crashes is where Selenium takes place, it gets the Firefox to open but not load the page. I think it migth be a problem with the webDriver of Selenium that must be updated.
I told him to install pip in his Mac and uninstall Selenium and reinstall it, is this how it is done in OS machines? Is there any issue related to my problem?
Thanks
It would be helpful if you had specify Selenium version and also which browser are you using and it's version too. But the behavior you described seems to be caused by having newer version of browser which the Selenium version you using doesn't support. So upgrading to newest version of Selenium (2.35) will likely make this problem disappear.

How to test webapp with different versions of IE from single windows machine?

I need to test a Web application on different versions of IE (IE9, IE8 & IE7).
I found that IE9 provides the compatibility view for IE8 & IE7 so I had installed IE9 in my test system.
There is one header META tag "X-UA-Compatible" by which you can set the compatibility view But in my case we don't have access to the source files.
If some how from selenium or by any other way if we can dynamically set the "X-UA-Compatible" tag then It can resolve my problem. Please let me know if there is any good way to Test the WebApp in different version of IE (7,8 & 9) from Single windows machine/instance.
Any suggestion would be appreciated.
Please do share your experience with this.
Thanks.
For testing your web application on different version of IE you can use online test tools, IETester, IECollection, Microsoft TestDrive
or in IE 8 & 9 press F12 and select IE version from Browser Mode menu
You speak about compatibility mode. Not sure if you know this but if you dont, press F12 in IE 9 to open developer tools. From there, you can set rendering version. This is the way I test on different IE versions.
From the official source:
4 ways tp test...
Another solution, you can try is spoon.net/, which is online simulator for browsers. You can select different browsers & versions there. You could also find other similar online simulator.
Microsoft provide virtual machines for different versions of IE at http://modern.ie . So, on a single machine it is possible to have multiple test versions of IE by running your tests in a virtual machine.
Update Nov 2014: There is now a way to achieve this.
Spoon has a Selenium grid that runs all versions of IE (Chrome and Firefox too) on the same Windows dev machine.
It uses the Spoon virtual machine to achieve this, by virtualizing a selenium setup including all browser nodes.
Its 100% compatible with your existing selenium tests. You don't need to launch the nodes beforehard, they launch on demand when test code requires a specific browser/version via capabilities.
Disclaimer: I work at Spoon and helped build this.

Is the new IE9 a standalone browser

Anyone that has installed the new IE9 know if I can keep IE8 installed? I do a lot of web testing and don't want to update to IE9 if I loose IE8.
best way is to install a Virtual Machine
Per Microsoft:
If you are running Windows Vista or
Windows 7 on your computer, you can
install the Internet Explorer 9 Beta
to replace your existing version of
Internet Explorer. After you install
Internet Explorer 9, you can uninstall
it to restore the previously installed
version of Internet Explorer.
So no, it will overwrite IE8 (at least the Beta will. I suppose this is not guaranteed to be the same for the release version).
I use Virtual PC with images of the browsers I need to test, but also and more lately, IETester, http://www.my-debugbar.com/wiki/IETester/HomePage. It allows you to run multiple versions of IE side by side.
If you want to be able to play with the new features of IE9 without installing the entire browser (which will replace IE8) you can install the Platform Preview. The PP is stand-alone, includes the latest features and bug fixes and has been getting updated roughly every 8 weeks. You can get the latest Platform Preview at:
www.ietestdrive.com
FYI: the production IE 9 does not accurately reproduce IE 8. I've got a CSS issue I'm chasing down now because IE 9's IE 8 mode isn't the same as real IE 8.
If you are concerned with testing how your site looks in IE8/7, you can use the Developer Tools (press F12) to switch the Browser modes and Document modes so that IE9 interacts with the web server as a different user agent, and renders the HTML document according to the version rules.
http://msdn.microsoft.com/en-sg/ie/ff468705(en-us).aspx#_New_Dev_Tools
IE9 beta is released as a Windows update, so after installing it and playing around, you can remove it from Programs and Features -> Installed Updates, which will recover IE8.
hit f12 on ie9, it will pop up the debug console. In the menu there is a browser mode option where you can set the browser to display as ie8 and a bunch of other versions too.
Also, if you're mouse focus is on the console and you hit ctrl+r, it will clear your browser cache... This is a feature that all the other browser debuggers lack.. ability to quickly clear cache.... I'm rambling now.
The best way to see your site on old versions of IE is that:
If you have IE9+, open your current version of InternetExplorer, press F12, click on "Browser Mode" tab, then choose the version you want.
see screenshot here:
Works better than IE-tester, and easier than using virtual machine.