Selenium performance with InternetExplorerDriver and IE11 - selenium

I am facing a very slow response when running my scripts on IE11. Sometimes, I get FocusWindowsClosed, ElementIsNotClickable. I have changed the zoom settings for all zones, created feature BFCACHE for IE in feature control, added capabilities into my code but nothing works for me. If anyone has any idea why I am facing this issue. Do i need to downgrade window or IE versions? I have also downloaded the same version of selenium client server with same IEDriver which is (3.8.0).

To start with, Selenium v3.8.0 of 2017-11-30 is more then 2 years older. Even the error trace logs would be difficult to debug. So as per best practices you may like to:
First of all, the fact that ...64-bit IEDriverServer executable populate the input fields with the character sequence very slowly as compared to 32-bit IEDriverServer executable.... is a known issue.
You can find a detailed discussion in IEDriverServer sends text very slowly using Selenium to the search field
Ensure the Internet Explorer Protective mode setting are properly configured.
Ensure the Zoom level is properly configured.
Ensure ignoreProtectedModeSettings is properly confugured.
Ensure setting up selenium to work with internet explorer.
Ensure FEATURE_BFCACHE is properly confugured.
Upgrade Selenium to current levels Version 3.141.59.
Upgrade IEDriverServer to latest IEDriverServer v3.150.1 level.
Note: As per best practices as Selenium Client and InternetExplorerDriver are released in sync and you must try to use both the binaries from the same major release.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
tl;dr
A couple of references:
Internet Explorer 11 getting stuck randomly while executing tests through IEDriverServer and Selenium
HTTP Status: '500' -> incorrect JSON status mapping for 'timeout' (408 expected) while clicking element with IEDriverServer Selenium and Java

Related

How to find the web browser version without setup() method using WebDriverManager

I am interested in getting the browser Version
I've two questions-
Question 1:- is there is a way to find out the browser version without setting up the browser?
or can we force stop the downloading of the Driver in the first place.
It is possible with the below code but the driver will be downloaded in this case.
WebDriverManager.chromedriver().setup(); //without doing this step
WebDriverManager.chromedriver().getDownloadedDriverVersion();
Question 2:-
Currently I am using wmic commands for browser detection which is used in WebDriverManager but it is failing on some systems.
what more alternatives ways are used in the WebDriverManager to fetch the browser version. I am curious to know about this as I've disabled wmic on my system still webDriverManager is working as usual(I guess with alternative methods within WebDriverManager).I am facing difficulties in understand the code. Please help me to understand the flow of the WebDriverManager like which methods/ways are used to detect the browser version and in what order.
Any help would be appreciated!
WebDriverManager
WebDriverManager is the open-source Java library that maintains the configuration management of the drivers required by Selenium WebDriver (e.g., chromedriver, geckodriver, msedgedriver, etc.) in a fully automated fashion.
Additionally, WebDriverManager provides other relevant features, such as the capability to discover browsers installed in the local system, building WebDriver objects (such as ChromeDriver, FirefoxDriver, EdgeDriver, etc.), and running browsers in Docker containers seamlessly.
The primary use of WebDriverManager is the automation of driver management (i.e., download, setup, and maintenance) of the drivers involved in your Test Automation Suite. Hence using WebDriverManager it's highly unlikely you can force stop the downloading of the Driver in the first place.
However, when you use a specific browser version for the first time in a while the matched driver version is downloaded and saved within the cache which is pretty much evident from the generated logs.
====== WebDriver manager ======
Current google-chrome version is 98.0.4758
Get LATEST chromedriver version for 98.0.4758 google-chrome
There is no [win32] chromedriver for browser in cache
Trying to download new driver from https://chromedriver.storage.googleapis.com/98.0.4758.102/chromedriver_win32.zip
Driver has been saved in cache [C:\Users\Sadanand.Kolhe\.wdm\drivers\chromedriver\win32\98.0.4758.102]
Moving forward, if the browser version and the matched driver version remains unchanged and at the same time the previous version of the downloaded version of the driver is available within the cache, the fresh downloading is avoided, which is evident from the logs generated from two back to back test execution.
====== WebDriver manager ======
Current google-chrome version is 98.0.4758
Get LATEST chromedriver version for 98.0.4758 google-chrome
Driver [C:\Users\Sadanand.Kolhe\.wdm\drivers\chromedriver\win32\98.0.4758.102\chromedriver.exe] found in cache
Regarding Q1, as of version 5, WebDriverManager allows detecting if a given browser is installed or not in the local system. To this aim, each manager provides the method getBrowserPath(). This method returns an Optional<Path>, which is empty if a given browser is not installed in the system or the browser path (within the optional object) when detected. See doc.
Regarding Q2, WebDriverManager uses internally a knowledge database called commands database. This database is a collection of shell commands used to discover the version of a given browser in the different operating systems (e.g., google-chrome --version for Chrome in Linux). This database contains WMIC commands for Windows but also queries to the registry. See doc again.

Selenium chromedriver that does not depend on current Chrome installation

Due to organization policy, the Chrome browser installation on my Windows Server machine is automatically updated. I have some processes that rely on python Selenium and chromedriver. Because of this, my process breaks whenever my org decides to push out an update.
Is it possible to have chromedriver depend on some binary other than Chrome browser that will not be managed by my organization so that this doesn't happen?
Few of the workarounds to resolve the issue:
We have kept the chrome exe file in an artifactory and we download and install that particular chrome version every time before our execution through automation (our requirement is like that).
As #Corey is suggesting you can webdrivermanager, PFB link for more details
https://github.com/bonigarcia/webdrivermanager
You can try Dockerized Selenium, there you'll have the control in the docker-compose.yml file.

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

What is the correct IEDriverServer version to use with IE 11 through Selenium

I just got updated to Windows 10 (x64). My old desktop had IE 11 but a lower version, as it was running Windows 7. I now have the following IE version:
Version: 11.648.17134.0
Update Versions: 11.0.115
I downloaded the latest IEDriverServer.exe that Selenium gave me (3.14). When I run it, when I do the get(url) (various urls), afterwards it fails to find elements. I looked and noticed that before the get(), driver.getWindowHandles() had one entry, but after the get() it had zero entries. This is the latest version. I tried setting compatibility mode but that did not do any good (set or not set). The tests will work fine with Chrome but someone else wrote the test and did not verify values were non-null before calling element.sendKeys(str), which IE appears to allow but Chrome throws an exception. And there are so many instances.
So, I need to find the correct IEDriverServer for my Windows 10 IE but I am having trouble doing so. Google did not give me much except it led me to the driver I already downloaded.
Can anyone help?
As a thumb-rule you can always use the released IEDriverServer from the respective released Selenium clients.
As an example,
If you are using Selenium v3.14
Download, extract and use IEDriverServer_Win32_3.14.0.zip or IEDriverServer_x64_3.14.0.zip
Snapshot:
Update
However to work with IE11 you have to take care of a couple of things which are beyond the scope of this discussion and are as follows:
How does the registry entry HKEY_LOCAL_MACHINE\…\FEATURE_BFCACHE for InternetExplorerDriver solves the Internet Explorer 11 issue?
Internet Explorer Protective mode setting and Zoom levels
Selenium InternetExplorerDriver doesn't get focus on the window
How to ignore protected Mode Settings for Internet Explorer using setCapability() through Selenium and Java?

Unable to run WebDriverIo tutorial

I'm trying to follow the WebDriverIo tutorial at http://webdriver.io/guide.html .
After setting up the Selenium server, when I try executing the test node script (step 7 in the tutorial), selenium warns me of some errors (see screenshot for full log), and I don't get any output returned.
Steps to reproduce:
I start the Selenium server
When I try running the node script, this happens (clock to zoom):
At this point a Firefox window opens automatically, and remains blank.
I'm running Firefox v52 and Selenium 3.0.1. I downloaded Geckodriver from https://github.com/mozilla/geckodriver/releases
Any obvious thing that I'm missing? I'm very new to Selenium and browser automation, forgive the generic input :)
If you have been here to get your Windows release of gecko driver : https://github.com/mozilla/geckodriver/releases, you may have miss this message :
"IMPORTANT: If you use geckodriver with Selenium, you must upgrade to
Selenium 3.3 since this release aligns HTTP responses with the
WebDriver standard."
(I can see you are in v3.0.1).