I am using Selenium version: ‘4.12.1’ and browser version 112. But facing difficulty during fileupload. I am using sendKeys method to send the filepath for xpath //input[@type=’file’].
Stacktrace:
org.openqa.selenium.UnsupportedCommandException: unknown command: unknown command: session / 9845 d50a442f6c23dc498210a0d253d7 / se / file
Build info: version: ‘4.12.1’, revision: ‘8e34639b11’ System info: os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘5.10.215-181.850.amzn2int.x86_64’, java.version: ‘17.0.11’
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [9845 d50a442f6c23dc498210a0d253d7, uploadFile {
file = UEsDBBQACAgIADtor1gAAAAAAAAAAAAAAAARAAAAYnVsa1NoaXBUZXN0Lnhsc3icuwNwZdxyqRrb52rOWGPr/23jDBdrR5v1/HWymMTSUh7oK8FFw96rixjjV2biitLFwNLp1XeHQyT7W0tLWxAzQEMt3zerJDcx3Xq7nnE4PhW+Z/O97JSwklwoxZ2TetcFYc8RitunZooR2t6Teof17pc2pWTqAPsz7zEgFabP90PNzWDGKLVMgLOYG/G2Z4/VgHb4/jPeWxSB28ZvYc/mbe4qVjaRii6tnCzzGBpM9qHDK/rRUjSPKhHa1VwP9zGj5yfG18kDONec8lgvSVjHuW1vDxTz1FuT5uqSpvql6lvpdhokgaMEisO09o29D7iSa8vWTK8aBq1H0QuT3m+WpxAd8DFGUgAAKTt/6nFSfj/a3H+axf/z0bnd7N4YbbmNxAdlM+Ockh7nEaYv8xCPZTPvC9IJBg4mza1mZ7Ib96lJhFsuPrT7u5ek7GXe2gt66P0eTDxCEkUlFaggH3XYCSq9oco5aZsM3vG5n5/lGDdNlUefbtf9AvkiaWH6cVqyWqUlPqlWbRtpS14E2wRVCsNpap/yCevNHnrzlsxCXkwbVYV2nr+nAeCFG+KdRvhtyVjVNXGDas1L7qgRnJcsHlrcl37oOAcBvJT+57Cgnjv7dqG41ytdBnnO/kaFwrwicU86FBLJH0Ku73/WlhFCpmX0apuEM3JnIJ8RzmhcTV+J5xN95g7RPzSrvAM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Rnsppoz3per4/ZLsz85Wx6ycGragOC3j3H0/qHODXDQtcJ0DBBLwPqCLnbaUrvssSvQDnyruW7+vLAHjf7XK4GHQE65oN7yPRHxMUIvdeq8Ed37dmq4L8sYzec6C7kg6qbQt2nZi1hl0IeCvwcdEcDpqzlUG1lcfvD8fF8yRPjCqikjvhJuePketU5F2n3v8ty1bS/MjUbwlLNOOhpEuUCYZcuDXgIaub/8NbUZdogcpM0p2kAMK7jNKiyTgHUnURMWDtnmNWJfwSBpQPwq8707MHvzg0B7FIoTHkh19+rCRlOMNxsuCokRJig+HRKIksNMmCU2W3Dnl2FyMtrgKaaawVB}]
Capabilities {
acceptInsecureCerts: true,
browserName: chrome,
browserVersion: 112.0 .5615 .49,
chrome: {
chromedriverVersion: 112.0 .5615 .49(bd2a7bcb881c…, userDataDir: /tmp/.org.chromium.Chromium…
},
goog: chromeOptions: {
debuggerAddress: localhost: 46485
},
networkConnectionEnabled: false,
pageLoadStrategy: normal,
platformName: linux,
proxy: Proxy(),
setWindowRect: true,
strictFileInteractability: false,
timeouts: {
implicit: 0,
pageLoad: 300000,
script: 30000
},
unhandledPromptBehavior: dismiss and notify,
webauthn: extension: credBlob: true,
webauthn: extension: largeBlob: true,
webauthn: extension: minPinLength: true,
webauthn: extension: prf: true,
webauthn: virtualAuthenticators: true
}
Element: [
[RemoteWebDriver: chrome on linux(9845 d50a442f6c23dc498210a0d253d7)] – > xpath: //div[@role=’dialog’]//input[@accept=’.xlsx’]]
Session ID: 9845 d50a442f6c23dc498210a0d253d
at java.base / jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base / jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java: 77)
at java.base / jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java: 45)
at java.base / java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java: 499)
at java.base / java.lang.reflect.Constructor.newInstance(Constructor.java: 480)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(Unknown Source)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(Unknown Source)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(Unknown Source)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(Unknown Source)
at org.openqa.selenium.remote.RemoteWebDriver.execute(Unknown Source)
at org.openqa.selenium.remote.RemoteWebElement.execute(Unknown Source)
at org.openqa.selenium.remote.RemoteWebElement.upload(Unknown Source)
at java.base / java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java: 197)
at java.base / java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java: 1625)
at java.base / java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java: 509)
at java.base / java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java: 499)
at java.base / java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java: 921)
at java.base / java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java: 234)
at java.base / java.util.stream.ReferencePipeline.collect(ReferencePipeline.java: 682)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(Unknown Source)
I have tried using JavascriptExecutor but didnot work