Turning off w3c permanently on msedgedriver.exe - selenium

My organization, just upgraded to Version 81.0.416.53 (Official build) (64-bit) of the edge chromium browser and I am the automation engineer for it. I am having issues getting my version of Watir/Ruby to work with it I have updated the Edge Webdriver to match the version number of the browser. I was originally using the Chrome class to interact with chromium, now that no longer works, but when I switch to Edge I keep getting a w3c error when I attempt to run my ui automation scripts. There doesn't appear to be a way for me to programatically turn off the Hardware acceleration for the webdriver through the Edge class in Watir/Selenium. I have turned it off for my browser, but when I run the webdriver, it is still turned on. Is there any way for me to make this change directly in the webdriver instead of trying to change an option that doesn't exist in Watir?
I am open to other suggestions if you have them. Thank You for your time.
System:
ruby 2.5.8p224 (2020-03-31 revision 67882) [x64-mingw32]
watir(6.16.5)
selenium-webdriver (3.142.7)
Edge Chromium Version 81.0.416.53 (Official build) (64-bit)
Windows 10
Code:
require 'watir'
Selenium::WebDriver::Edge::Service.driver_path = "c:/webdriver_location/msedgedriver.exe"
client = :edge
browser = Watir::Browser.new(client)

I ran into a similar issue before. You could use the options like Chrome's in Edge Chromium. The code in ruby is like the following:
capabilities = { "edgeOptions" => {'w3c' => false} }
I'm not familiar with Watir, don't know if this syntax can be used in Watir. You could change it into the usable one in Watir.
For more detailed information, you could also refer to this thread.

Related

Why is chromedriver tied to chrome version?

I'm starting to use selenium and ChromeDriver in order to automate tasks in Chrome. I'm interested in scaling the task across multiple managed windows PC's.
I understand that updates of Chrome might break functionality in ChromeDriver. But I'm concerned it's the right tool because manually updating based on the chrome version results in a lot of maintenance as we'd have to manually place the executable on each system.
Is ChromeDriver really "whitelisting" with which chrome version it works? and why is that?
Browsers would have updates, which the driver also must have in order to invoke and interact with the browser, and hence your driver version must be in sync with the browser version. It is not just for Chrome, but for Firefox, and Edge also. One thing you can do is to use the ChromeDriverManager by installing the webdriver-manager library.
In Python, you do like this:
pip install webdriver-manager
In the py file, you can invoke the chromedriver:
from webdriver_manager import ChromeDriverManager
Then, when you initialize the driver, you can pass in the ChromeDriverManager:
driver = webdriver.Chrome(ChromeDriverManager().install())
With this, your driver and browser would be in sync. You need not worry about the incompatibility of driver-browser versions.
Please note: you would get a depcration warning with the above driver line of code, for which you need to include Service object; however, for now, it is a warning and not an error, so your code would not hamper the execution, but sooner or later, you must use Service object.
Here is a good article you can refer to Medium

Selenium performance with InternetExplorerDriver and IE11

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

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?

ERROR :gpu_process_transportfactory.cc(1`017) Lost UI shared context with NON headless chrome [duplicate]

I have a Windows 10 laptop running a Windows 7 Virtual Machine. Inside the Virtual Machine, when i start the WebDriver, it gives the error gpu_process_transport_factory.cc<1009> Lost UI shared context when it is started:
IWebDriver driver = new ChromeDriver() //This causes the 1009 Error
Also then varies for Failed to query stereo recording and Failed to send GpuChannelMsg_CreateCommandBuffer and command_buffer_proxy_impll.cc<115> Shared memory handle is not valid.
This has been working for months and no changes were made (this WebDriver is the sole purpose of the Virtual Machine), the laptop running it is running fine (ie. no GPU problems). The WebDriver still navigates through pages, but giving further errors and 10x slower.
EDIT: Updated to ChromeDriver to 2.35 and still the same behavior.
Headless Chrome was shipped in Chrome 59 by Google Team which introduced a way to run the Chrome Browser in a Headless Environment.
A note was added as :
Headless mode has been available on Mac and Linux since Chrome 59. Windows support came in Chrome 60.
The article Getting Started with Headless Chrome mentioned that :
--disable-gpu \ # Temporarily needed if running on Windows.
A note was added as :
Right now, you'll also want to include the --disable-gpu flag if you're running on Windows.
As per the discussion Headless: make --disable-gpu flag unnecessary it was clear that :
The --disable-gpu flag is no longer necessary on Linux or Mac OSX. It will also become unnecessary on Windows as soon as the bug SwiftShader fails an assert on Windows in headless mode is fixed.
What happened under the hood?
As per the discussion headless: Switch from osmesa to SwiftShader as Google/Chromium team decided to ship SwiftShader with Chrome, the team thought to start using it to render GL content in Headless Mode. This required a couple of changes as follows :
Skip GPU data collection in Headless Mode since SwiftShader isn't considered a software implementation by that code which lead to a failure when we tried to retrieve information from the Window System.
Only skip GL initialization in InitializeStaticEGLInternal if we intend to use osmesa. SwiftShader requires initialization like the other non-software implementations.
SwiftShader is currently not supported on Mac OSX, so the team decided to continue to use the physical GPU in Headless Mode on that platform (unlike on other platforms where everything is software rendered).
So, to disable WebGL support in Headless Mode they decided to use --disable-gpu and --disable-software-rasterizer
The idea to Support WebGL in headless is still under discussion but SwiftShader fails an assert on Windows in headless mode with an error as :
[0117/125830.649194:ERROR:gpu_process_transport_factory.cc(1043)] Lost UI shared context.
DevTools listening on ws://127.0.0.1:37429/devtools/browser/1f0b2bf7-dfdd-44ac-9da7-f2659d352f0d
Conclusion
This error doesn't impact your #Test and you can ignore the error for the time being.
This appears to be an issue with the latest version of Chrome (65.0.3325.146). By rolling back to an earlier version of Chrome (64.0.3282.186) the issue disappeared for me.
Will investigate further and update here if I find any more info but as a temporary workaround you can uninstall chrome and install version 64.0.3282.186.
'Lost UI Shared Context' was mistaken for an error while it's actually a logging output.
This has been fixed since Chrome 72.0. no extraneous arguments needed.

How to run chrome driver in background using selenium with Ruby for Mac OSx?

Sometimes, the browser window comes to the foreground and I'm clicking it accidentally which makes the test fails on some occasions. So, I just want to know, is there any way that I can keep the chrome driver window in the background.
Details:
< ChromeDriver version: 2.28.455517 >
< Chrome version: 58.0.3029.96 >
A few words about the solution to your Question:
As per best practices, you should try to execute your Test-scripts / Automation-framework in an isolated Test Environment with all the required Hardware and Software configurations and setup.
While the execution is in process, there should be no manual user interaction in-between.
In-case you want to do multitasking, use Ghost/Headless Browsers. You will find a detailed discussion in Which drivers support “no-browser”/“headless” testing?.
Htmlunitdriver & PhantomJS are the two mostly widely used Ghost/Headless Browsers.
If you are specific about using ChromeDriver you can use Chrome headless as per the documentation here.
First and foremost rule is that we should not do any other work while your scripts are running. We may use actions class for hovering., etc, while you move your cursor it may lead to failing your test case. Hope It will be useful to you.
You can try using headless switch available for Chrome.
This will run the automation in the headless mode and you will not be disturbed.
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
Afterward, initiate Chrome.