mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.03k stars 1.51k forks source link

Getting 'WebDriverError: HTTP method not allowed' error message while using file command #2156

Closed lacell75 closed 5 months ago

lacell75 commented 5 months ago

System

Testcase

Geeting 'WebDriverError: HTTP method not allowed' error message while using file class methods, below are the details:-

Node version: v18.19 WebdriverIO: latest

await browser.file(readFileSync(filePath).toString('base64'));

Works correctlty with firefox 108

Stacktrace

KO on firefox 122

2024-01-29T15:41:29.074Z INFO webdriver: COMMAND file("<Screenshot[base64]>")
[0-0] 2024-01-29T15:41:29.074Z INFO webdriver: [POST] http://seltest.selenium.factory.intescia.dev/wd/hub/session/3bdd7373-b66d-40ad-a16b-e75d0a344e9d/file
[0-0] 2024-01-29T15:41:29.074Z INFO webdriver: DATA "<Screenshot[base64]>"
[0-0] 2024-01-29T15:41:29.146Z DEBUG webdriver: request failed due to missing body
[0-0] 2024-01-29T15:41:29.147Z WARN webdriver: Request failed with status 405 due to HTTP method not allowed
[0-0] 2024-01-29T15:41:29.147Z INFO webdriver: Retrying 1/2
[0-0] 2024-01-29T15:41:29.147Z INFO webdriver: [POST] http://seltest.selenium.factory.intescia.dev/wd/hub/session/3bdd7373-b66d-40ad-a16b-e75d0a344e9d/file
[0-0] 2024-01-29T15:41:29.147Z INFO webdriver: DATA "<Screenshot[base64]>"
[0-0] 2024-01-29T15:41:29.222Z DEBUG webdriver: request failed due to missing body
[0-0] 2024-01-29T15:41:29.222Z WARN webdriver: Request failed with status 405 due to HTTP method not allowed
[0-0] 2024-01-29T15:41:29.223Z INFO webdriver: Retrying 2/2
[0-0] 2024-01-29T15:41:29.223Z INFO webdriver: [POST] http://seltest.selenium.factory.intescia.dev/wd/hub/session/3bdd7373-b66d-40ad-a16b-e75d0a344e9d/file
[0-0] 2024-01-29T15:41:29.223Z INFO webdriver: DATA "<Screenshot[base64]>"
[0-0] 2024-01-29T15:41:29.302Z DEBUG webdriver: request failed due to missing body
[0-0] 2024-01-29T15:41:29.302Z ERROR webdriver: Request failed with status 405 due to Error: HTTP method not allowed
[0-0] 2024-01-29T15:41:29.306Z INFO webdriver: COMMAND getUrl()
[0-0] 2024-01-29T15:41:29.307Z INFO webdriver: [GET] http://seltest.selenium.factory.intescia.dev/wd/hub/session/3bdd7373-b66d-40ad-a16b-e75d0a344e9d/url
[0-0] 2024-01-29T15:41:29.329Z INFO webdriver: RESULT https://content-production.dev.private.mesao.com/import
[0-0] Error in "0: When I upload a file "BOAMP/19-86053.xml" on "contracts" import with text:"contractForDieDetailsView ""
Error: HTTP method not allowed
    at getErrorFromResponseBody (file:///C:/2-gitlab/end-to-end-tests-wdio/node_modules/webdriver/build/utils.js:190:16)
    at NodeJSRequest._request (file:///C:/2-gitlab/end-to-end-tests-wdio/node_modules/webdriver/build/request/index.js:193:23)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Browser.wrapCommandFn (file:///C:/2-gitlab/end-to-end-tests-wdio/node_modules/@wdio/utils/build/shim.js:88:29)

OK on firefox 108

0-0] 2024-01-29T15:39:42.499Z INFO webdriver: COMMAND file("<Screenshot[base64]>")
[0-0] 2024-01-29T15:39:42.500Z INFO webdriver: [POST] http://sel451557.selenium.factory.dev/wd/hub/session/00a1c9c7-af0f-4af9-a9e5-0f2a87bacec5/file
[0-0] 2024-01-29T15:39:42.500Z INFO webdriver: DATA "<Screenshot[base64]>"
[0-0] 2024-01-29T15:39:42.580Z INFO webdriver: RESULT /tmp/session838567036708511446400a1c9c7-af0f-4af9-a9e5-0f2a87bacec5/upload17796062595320620048file/66-531268.xml
whimboo commented 5 months ago

Could you please attach a trace-level log from geckodriver? Read more about reporting actionable bugs in our contribution guidelines.

lacell75 commented 5 months ago

How can I activate geckodriver logs when it executing with selenium in standalone mode?

Le lun. 29 janv. 2024 à 17:25, Henrik Skupin @.***> a écrit :

Could you please attach a trace-level log https://firefox-source-docs.mozilla.org/testing/geckodriver/TraceLogs.html from geckodriver? Read more about reporting actionable bugs in our contribution guidelines https://firefox-source-docs.mozilla.org/testing/geckodriver/Bugs.html.

— Reply to this email directly, view it on GitHub https://github.com/mozilla/geckodriver/issues/2156#issuecomment-1915067246, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH5XZJCCOH42QCXWSWG5OSTYQ7EOPAVCNFSM6AAAAABCPVGISKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJVGA3DOMRUGY . You are receiving this because you authored the thread.Message ID: @.***>

whimboo commented 5 months ago

I don't know what stand-alone mode means. But usually you set the remote.log.level preference via the capabilities: https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver#capabilities

lacell75 commented 5 months ago

Fixed here https://github.com/webdriverio/webdriverio/pull/12141

whimboo commented 5 months ago

Great to hear. Thanks!