Unable to click element using By.name locator in Appium using javascript

I am using Appium for automation of desktop application on Windows 10. Programming language I am referring is JavaScript. I am trying to click UI element on application using By.name. But I am encountering errors. Code I have written is as follows :


“use strict”;
var wd = require(“selenium-webdriver”),
By = wd.By,
mobileBy = wd.mobileBy,
until = wd.until;

//Setup desirable capabilities :
var desiredCaps = {
platformName: “Windows”,
deviceName: “windowsPC”,
app:
“C:\Program Files\xxx\bin\xxx.exe”,
browserName: “”
};

async function testEribank() {
let driver = await new wd.Builder()
.usingServer(“http://127.0.0.1:4723”)
.withCapabilities(desiredCaps)
.build();

var byName = await driver.findElement(By.name(“File”));
byName.click();

await Promise.reject(new Error(“test”));
}

testEribank();


Error I am getting is :

(node:57804) UnhandledPromiseRejectionWarning: WebDriverError: Unimplemented Command: css selector locator strategy is not supported
at parseHttpResponse (d:\Appium_Javascript\node_modules\selenium-webdriver\lib\http.js:659:11)
at Executor.execute (d:\Appium_Javascript\node_modules\selenium-webdriver\lib\http.js:568:28)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async WebDriver.execute (d:\Appium_Javascript\node_modules\selenium-webdriver\lib\webdriver.js:731:17)
at async testEribank (d:\Appium_Javascript\appiumJavascriptProject\test_rms.js:20:16)
(Use node --trace-warnings ... to show where the warning was created)
(node:57804) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)


Is there any solution to select element by name?

If I use Python instead of JavaScript then I can click that element using name locator as driver.find_element_by_name(‘File’).click()
But demand is using JavaScript.
Any solution ?