aerokube / windows-images

Step by step instructions for building Docker images with Windows
Apache License 2.0
221 stars 44 forks source link

File Upload Scenario #42

Open arunganesh-a opened 3 years ago

arunganesh-a commented 3 years ago

Hi We are running our testes on windows containers created using the steps given in the repo.

We have a file upload scenario that we want to run in the container.

Is it possible by using LocalFileDetector()??..

or is there any other way through which this can be achieved.

vania-pooh commented 3 years ago

@arunganesh-a standard approach with LocalFileDetector() should work.

arunganesh-a commented 3 years ago

@vania-pooh :

This the code that I am using

         ((RemoteWebDriver) driver).setFileDetector(
                new LocalFileDetector()
            );

        driver
            .findElement(By.xpath("//input[@id='fileName']"))
            .sendKeys(
                file.getAbsolutePath()
            );

but when I run this I am getting the below error:

org.openqa.selenium.UnsupportedCommandException: Command not found: POST /session/88951701-93e4-4f6f-b964-b8acd1798916/file Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'SPPW018', ip: '10.14.77.8', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261' Driver info: org.openqa.selenium.remote.RemoteWebDriver Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, javascriptEnabled: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.edgechromium: false, ie.edgepath: , ie.ensureCleanSession: false, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: true, ignoreZoomSetting: true, initialBrowserUrl: http://localhost:4444/, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}

The same script is working in chrome.

vania-pooh commented 3 years ago

@arunganesh-a Selenoid should be run with -enable-file-upload flag. Probably iedriver does not have /file API implemented.

arunganesh-a commented 3 years ago

@vania-pooh : After enabling -enable-file-upload getting the below error. now the behaviour is same in both ie as well as chrome containers. org.openqa.selenium.InvalidArgumentException: Attempting to upload file '/tmp/f85de7b7-1dfd-41f4-9e1e-225621e27c36/SMSBROADCASTBUSINESS_2018-04-09.txt' which does not exist. Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'SPPW018', ip: '10.14.77.8', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261' Driver info: org.openqa.selenium.remote.RemoteWebDriver Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, javascriptEnabled: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.edgechromium: false, ie.edgepath: , ie.ensureCleanSession: false, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: true, ignoreZoomSetting: true, initialBrowserUrl: http://localhost:4444/, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}

aandryashin commented 3 years ago

You have to build another selenoid to windows image and run it with -emable-file-upload in front of iedriver. Regular selenoid should be run without -enable-file upload.

пт, 8 окт. 2021 г., 08:00 arunganesh-a @.***>:

After enabling -enable-file-upload getting the below error. now the behaviour is same in both ie as well as chrome containers. org.openqa.selenium.InvalidArgumentException: Attempting to upload file '/tmp/f85de7b7-1dfd-41f4-9e1e-225621e27c36/SMSBROADCASTBUSINESS_2018-04-09.txt' which does not exist. Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'SPPW018', ip: '10.14.77.8', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261' Driver info: org.openqa.selenium.remote.RemoteWebDriver Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, javascriptEnabled: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.edgechromium: false, ie.edgepath: , ie.ensureCleanSession: false, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: true, ignoreZoomSetting: true, initialBrowserUrl: http://localhost:4444/, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aerokube/windows-images/issues/42#issuecomment-938344800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKY23KZWESQKGHPZQNUGNLUFZ3HTANCNFSM5FOOPPJA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.