How to use Edge Chromium webdriver "unknown error: cannot find MSEdge binary" - selenium

I am trying to use the WebDriver for the Edge Chromium version with PostMan, but I cannot make it work.
WebDriver Download: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Doc: https://learn.microsoft.com/en-us/microsoft-edge/webdriver
I try to add the Edge Chromium and Webdriver in the system PATH environment variable and no difference. I think the selenium implementation in java work with the Edge Chromium Webdriver
msedgedriver.exe --port 9515
POST localhost:9515/session
{
"capabilities":{
"firstMatch":[
{
}
],
"alwaysMatch":{
"browserName":"MicrosoftEdge",
"platformName":"windows",
"goog:chromeOptions":{
"extensions":[
],
"args":[
]
}
}
},
"desiredCapabilities":{
"browserName":"MicrosoftEdge",
"version":"",
"platform":"WINDOWS",
"goog:chromeOptions":{
"extensions":[
],
"args":[
]
}
}
}
{
"value": {
"error": "unknown error",
"message": "unknown error: cannot find MSEdge binary",
"stacktrace":
"Backtrace:\n\tOrdinal0 [0x00007FF6678D7C52+1932370]\n\tOrdinal0
[0x00007FF66783CDA2+1297826]\n\tOrdinal0
[0x00007FF6677A0A51+658001]\n\tOrdinal0 [0x00007FF667710F1F+69407]\n\tOrdinal0
[0x00007FF66770EF02+61186]\n\tOrdinal0 [0x00007FF667737DBD+228797]\n\tOrdinal0
[0x00007FF6677351AF+217519]\n\tOrdinal0 [0x00007FF66771706F+94319]\n\tOrdinal0
[0x00007FF66771822E+98862]\n\tOrdinal0
[0x00007FF66785B531+1422641]\n\tGetHandleVerifier
[0x00007FF6679991E9+656297]\n\tGetHandleVerifier
[0x00007FF667998F81+655681]\n\tGetHandleVerifier
[0x00007FF6679A104C+688652]\n\tGetHandleVerifier
[0x00007FF6679999C3+658307]\n\tOrdinal0
[0x00007FF66785177E+1382270]\n\tOrdinal0
[0x00007FF66785D9D6+1432022]\n\tOrdinal0
[0x00007FF66785C84D+1427533]\n\tBaseThreadInitThunk
[0x00007FF909056FD4+20]\n\tRtlUserThreadStart [0x00007FF90AB5B1F1+33]\n"
}
}
The WebDriver should open and be able to execute other commands

I suggest you to refer steps below may help to solve the issue.
(1) First try to set the environment variable for your Edge (chromium) application.
(2) Try to open PowerShell window and try to launch the Edge web driver.
(3) Launch the Postman app and try to use http://localhost:9515/session as POST request.
(4) Add code below as body of the request.
{
"desiredCapabilities": {
"nativeEvents": false,
"browserName": "edg",
"version": "",
"platform": "ANY",
"javascriptEnabled": true,
"takesScreenshot": true,
"handlesAlerts": true,
"databaseEnabled": true,
"locationContextEnabled": true,
"applicationCacheEnabled": false,
"browserConnectionEnabled": true,
"cssSelectorsEnabled": true,
"webStorageEnabled": true,
"rotatable": true
}
}
(5) Try to send the request.
Reference:
SeleniumHQ/selenium
Notes:
Your environment variable should properly set and referenced to your
Edge (chromium) correctly.
Use the supported version of Edge web driver with your Edge
(chromium) browser.

This should really be a comment and not a full answer (ridiculous reputation system tbh); Anyway, to add to Deepak-MSFT's answer - after adding the environment variables be sure to restart your IDE.
I added my MSEdge directory to the PATH and Eclipse would still complain. Everything worked after I closed and re-opened Eclipse.
Also check if you are pointing to MSEdge.exe or the directory where MSEdge.exe is located. I noticed that it only works if you point to the dir and not the .exe.
So it would be something like: C:\Program Files (x86)\Microsoft\Edge Dev\Application\

I did face the same issue, and trust me I tried doing every possible thing, but you know what helped me, though it might sound lame to you, the Edge browser version it was old, when I updated it, it worked for me, the error was resolved, do give it a shot as well
Unlike Chrome browser it does not throws error lie the browser driver version and browser are incompatible.
Yours's sincerely,
A frustrated Automation tester

Related

How to bypass or avoid the download message - This type of file may harm your computer, Do you want to keep this file ? Using webdriverIO

I am trying to download an apk file using webdriverIO. I kept the following args and prefs for chrome, but still ath the end of download its prompting for the message - This type of file may harm your computer, Do you want to keep this file ?. How can I skip this ?
"goog:chromeOptions": {
w3c: false,
args: ["--reduce-security-for-testing", "--start-maximized", "--disable-gpu","--safebrowsing-disable-download-protection","--disable-web-security","disable-extensions","safebrowsing-disable-extension-blacklist"],
prefs: {
'directory_upgrade': true,
'download.prompt_for_download': false,
'prompt_for_download': true,
'download.default_directory': downloadDir,
"safebrowsing.enabled":true
}
},
Please dont mark this as duplicate, I tried the solutions provided by :
https://stackoverflow.com/questions/34130774/how-to-disable-this-type-of-file-can-harm-your-computer-pop-up
https://stackoverflow.com/questions/59840198/how-to-hide-the-warning-this-type-of-file-can-harm-your-computer-while-downloa
but nothing worked. Please help

Use custom firefox browser version capability for geckodriver

I build selenoid docker images for firefox myself and have them configured in the browsers.json as follows:
"firefox": {
"default": "66.0",
"versions": {
"beta": {
"image": "my/path/to/firefox:beta",
"port": "4444"
},
"66.0": {
"image": "selenoid/vnc:firefox_66.0",
"port": "4444"
}
}
}
Sending the version=beta capability causes the webdriver to throw
selenium.WebDriverException: Requested environment is not available
In the logs I found
2019/04/03 08:17:29 [3] [PROXY_TO] [90ab834d22aa3bbe2731eeb550497eec7ef9fb11c1e7f4609d617cf6a25124e7] [http://172.17.0.4:4444]
2019/04/03 08:17:29 [3] [SESSION_ATTEMPTED] [http://172.17.0.4:4444] [1]
2019/04/03 08:17:29 [3] [SESSION_ATTEMPTED] [http://172.17.0.4:4444/wd/hub] [2]
2019/04/03 08:17:29 [3] [SESSION_FAILED] [http://172.17.0.4:4444/wd/hub] [400 Bad Request]
Since the exact same thing works for chrome and it also works if I set "default": "beta" in the browsers.json and do not set the version capability, I assume this happens because geckodrivers matches the version from the capabilites against the actual browser version. (as presumed here).
I have several ideas how to work around this, but do not know how to technically implement these:
Prevent Selenoid from passing the version capability to the selenium driver (geckodriver in this case)
Prevent geckodriver from checking version capability and browser version
Add another flag to selenoid to get the docker image from browsers.json such as browser_version instead of version
Add another fake browser to browsers.json and set the beta to default, then just set the browserName capability. The problem here is, selenoid checks for the browser names and if it does not match chrome, firefox or opera the selenoid container cannot be started. E.g.:
browserName=firefox-beta
"firefox-beta": {
"default": "beta",
"versions": {
"beta": {
"image": "my/path/to/firefox:beta",
"port": "4444"
}
}
}
Any help or further information will be greatly appreciated
For w3c compliant browsers (as of today, only non-Chrome), they require the browser version to be in the browserVersion capability instead of version. I see you tried browser_version, but did you try browserVersion?
https://www.w3.org/TR/webdriver1/#capabilities

My nightwatch.js tests not runs in Chrome headless of CentOS

I run nightwatch.js tests using Nightwatch version 1.0.18 and It's working in windows environment but when I run it in centOS after installment of Xvfb I found below error.
Error while running .navigateTo() protocol action: invalid session id
Error while running .locateMultipleElements() protocol action: invalid session id
Error while running .locateMultipleElements() protocol action: invalid session id
Here is my nightwatch.json file code:
{
"src_folders": [
"./tests"
],
"output_folder": "./reports",
"custom_commands_path": "./custom_commands",
"custom_assertions_path": "",
"test_workers": false,
"webdriver": {
"start_process": true
},
"test_settings": {
"default": {
"webdriver": {
"port": 9515,
"server_path": "./node_modules/chromedriver/lib/chromedriver/chromedriver",
"cli_args": [
"--log",
"debug"
]
},
"skip_testcases_on_fail": true,
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": [
"headless",
"no-sandbox",
"disable-gpu"
]
}
}
}
}
}
am I missing something to run my tests in the centOS environment because it is running in the windows environment?
I had the same issue with Nightwatchjs and the npm chomedriver setup.
Background:
Everything was working until I just recently updated Chromium on my system. In addition to the errors in the original post, verbose logging also showed:
{
message: 'unknown error: Chrome failed to start: exited abnormally',
error: [
"(unknown error: DevToolsActivePort file doesn't exist)",
'(The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)',
'(Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.9.0-8-amd64 x86_64)'
],
}
After downloading the standalone chromedriver (2.46.628388) to match my Chromium version (72.0.3626.69) it was still showing the same errors.
Solution:
I ended up downloading an older version of Chromium (71.0.3578.127) and setting chromeOptions.binary to the new path of the chromium 71 binary. I also had to include 'no-sandbox' with chromeOptions.args.
Here is the snippet from the site mentioned above:
Downloading old builds of Chrome / Chromium
Let's say you want a build of Chrome 44 for debugging purposes. Google does not offer old builds as they do not have up-to-date security fixes.
However, you can get a build of Chromium 44.x which should mostly match the stable release. Here's how you find it:
Look in https://googlechromereleases.blogspot.com/search/label/Stable%20updates for the last time "44." was mentioned.
Loop up that version history ("44.0.2403.157") in the Position Lookup
In this case it returns a base position of "330231". This is the commit of where the 44 release was branched, back in May 2015.*
Open the continuous builds archive
Click through on your platform (Linux/Mac/Win)
Paste "330231" into the filter field at the top and wait for all the results to XHR in.
Eventually I get a perfect hit: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/330231/
Sometimes you may have to decrement the commit number until you find one.
Download and run!
Upgrading to the latest version of chromedriver solved the issue for me. You can find the latest version here; https://www.npmjs.com/package/chromedriver
In my situation, when that error occurs:
Error while running .navigateTo() protocol action: invalid session id
I added the following code into .travis.yml:
addons:
chrome: stable

Unable to connect to a site from Testcafe IDE on OSX

My fixtures are set up like so
{
"fixtures": [
{
"name": "login",
"pageUrl": "http:\/\/localhost:3000\/",
"tests": [
{
"name": "type name",
"commands": [
{
"type": "type-text",
"studio": {
},
"callsite": "0",
"selector": {
"type": "js-expr",
"value": "input[type=email]"
},
"options": {
},
"text": "example#email.com"
}
]
}
]
}
]
}
with one simple test to find the input and type some text but when running the command I get
testcafe chrome login.testcafe
ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
Type "testcafe -h" for help.
I've seen this issue a couple of times on their issues board one relating to CI integration on a Linux server and another which seems like a similar issue of trying to connect to localhost
https://github.com/DevExpress/testcafe-browser-provider-electron/issues/20
https://github.com/DevExpress/testcafe/issues/1133
New to testcafe any help would be appreciated!
I've found the solution some network policies don't allow access to your machine on some ports in my example it's 57501.
testcafe chrome login.testcafe --hostname localhost
adding --hostname resolves the issue
documentation
https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--hostname-name
I still don't know how to launch from the IDE but this resolves my main issue.
TestCafe Studio Preview does not support setting command line options (hostname in your case). The TestCafe team is going to implement this functionality in the official release.
So, for now, it is only possible to run tests via a command line.
UPDATE:
You can set the hostname option in the TestCafe Studio Settings dialog:

Q: CodeceptJS "unknown error": call function result missing 'value'

This is my Test
Feature('Test');
Scenario('test something', (I) => {
I.amOnPage("");
I.see("Welcome");
I.fillField('j_username', 'xxxxxx');
I.wait(3);
});
This is my codeceptjs.JSON
{
"tests": "asd/*_test.js",
"timeout": 10000,
"output": "./output",
"smartwait":"1000",
"helpers": {
"WebDriverIO": {
"url": "http://localhost:8080/xxxx/",
"browser": "chrome"
}
},
"include": {
"I": "./steps_file.js"
},
"bootstrap": false,
"name": "yenideneme"
}
I am try CodeceptJS with Webdriverio helper for end-to-end tests. Connect to the server and I.see("") passed. But added I.fillField() taken this Error=
test something:
unknown error: call function result missing 'value'
I try to update chrome and chromedriver but not worked.
And other project taken Error=
2) e2e
"after each" hook: finalize codeceptjs for "welcome Page #fristBlank":
unknown error: call function result missing 'value'
It may be related to an issue with Chrome 65. After upgrading from Chrome 64, I started seeing the same issue. Downgrading to the version 64 should help temporarily.
A long-term solution is making sure that Chromedriver is upgraded to version 2.36, which is supposed to work with Chrome 65. However, a simple "npm install chromedriver" may not be sufficient. Your Selenium may still try to load the old version. The actual solution depends on your environment setup.
Got the same problem yesterday after a chrome update(v65).
Uninstalled and downloaded version 63 from this site.
http://www.geocities.jp/ecvcn/exam/chrome_installer.html
Problem Solved.