Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP code indicates that request is invalid at line 168 #44

Open
Vertexwahn opened this issue Sep 8, 2023 · 6 comments
Open

HTTP code indicates that request is invalid at line 168 #44

Vertexwahn opened this issue Sep 8, 2023 · 6 comments

Comments

@Vertexwahn
Copy link

Vertexwahn commented Sep 8, 2023

I tried this program on Ubuntu 22.04:

#include "webdriverxx.h"

using namespace webdriverxx;

int main()
{
  FirefoxOptions opts;
  WebDriver browser = Start(Firefox());
  browser.Navigate("https://duckduckgo.org");
  Element elem = browser.FindElement(ByCss("input[name=q]"));
  elem.SendKeys("sha512 helloworld");
  elem.Submit();
  getchar();

  return 0;
}

I get the following output:

terminate called after throwing an instance of 'webdriverxx::WebDriverException'
  what():  HTTP code indicates that request is invalid at line 168, file include/webdriverxx/detail/resource.h called from ProcessResponse (HTTP code: 405, body: HTTP method not allowed) called from Download (request: GET, command: , resource: http://localhost:4444/session/28380e5c-dcb6-46cc-b7f1-5a8454491694) called from CreateSession

Is it intended that this error is thrown? I guess not. Does this happen only in my system?

I see Firefox popping up and disappearing again - I assume that is the default behavior?

What the selenium server shows:

java -jar selenium-server-4.12.1.jar standalone
21:37:14.954 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
21:37:14.957 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
21:37:15.321 INFO [NodeOptions.getSessionFactories] - Detected 24 available processors
21:37:15.321 INFO [NodeOptions.discoverDrivers] - Looking for existing drivers on the PATH.
21:37:15.321 INFO [NodeOptions.discoverDrivers] - Add '--selenium-manager true' to the startup command to setup drivers automatically.
21:37:15.420 WARN [SeleniumManager.lambda$runCommand$1] - Exception managing chrome: Unable to discover proper chromedriver version in offline mode
21:37:15.472 WARN [SeleniumManager.lambda$runCommand$1] - edge cannot be downloaded
21:37:15.790 INFO [NodeOptions.report] - Adding Chrome for {"browserName": "chrome","goog:chromeOptions": {"args": ["--remote-allow-origins=*"]},"platformName": "linux"} 24 times
21:37:15.791 INFO [NodeOptions.report] - Adding Firefox for {"browserName": "firefox","platformName": "linux"} 24 times
21:37:15.845 INFO [Node.] - Binding additional locator mechanisms: relative
21:37:15.855 INFO [GridModel.setAvailability] - Switching Node c411b288-5889-4da4-bb80-45206671dbfb (uri: http://192.168.49.1:4444) from DOWN to UP
21:37:15.855 INFO [LocalDistributor.add] - Added node c411b288-5889-4da4-bb80-45206671dbfb at http://192.168.49.1:4444. Health check every 120s
21:37:15.959 INFO [Standalone.execute] - Started Selenium Standalone 4.12.1 (revision 8e34639b11): http://192.168.49.1:4444
21:37:19.457 INFO [LocalDistributor.newSession] - Session request received by the Distributor:
[Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true}]
21:37:21.694 INFO [LocalNode.newSession] - Session created by the Node. Id: 28380e5c-dcb6-46cc-b7f1-5a8454491694, Caps: Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 117.0, moz:accessibilityChecks: false, moz:buildID: 20230824214342, moz:debuggerAddress: 127.0.0.1:13030, moz:geckodriverVersion: 0.33.0, moz:headless: false, moz:platformVersion: 6.2.0-32-generic, moz:processID: 23519, moz:profile: /tmp/rust_mozprofileMivsqe, moz:shutdownTimeout: 60000, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://192.168.49.1:4444/sess..., se:cdpVersion: 85.0, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
21:37:21.698 INFO [LocalDistributor.newSession] - Session created by the Distributor. Id: 28380e5c-dcb6-46cc-b7f1-5a8454491694
Caps: Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 117.0, moz:accessibilityChecks: false, moz:buildID: 20230824214342, moz:debuggerAddress: 127.0.0.1:13030, moz:geckodriverVersion: 0.33.0, moz:headless: false, moz:platformVersion: 6.2.0-32-generic, moz:processID: 23519, moz:profile: /tmp/rust_mozprofileMivsqe, moz:shutdownTimeout: 60000, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://192.168.49.1:4444/sess..., se:cdpVersion: 85.0, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
21:37:21.715 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "971a92a70dc62201bfa990b1df3846e3","eventTime": 1694201841711764949,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "localhost:4444","http.method": "GET","http.scheme": "HTTP","http.status_code": 405,"http.target": "\u002fsession\u002f28380e5c-dcb6-46cc-b7f1-5a8454491694"}}

21:37:23.563 INFO [LocalSessionMap.lambda$new$0] - Deleted session from local Session Map, Id: 28380e5c-dcb6-46cc-b7f1-5a8454491694
21:37:23.564 INFO [GridModel.release] - Releasing slot for session id 28380e5c-dcb6-46cc-b7f1-5a8454491694
21:37:23.565 INFO [SessionSlot.stop] - Stopping session 28380e5c-dcb6-46cc-b7f1-5a8454491694

@tokox
Copy link

tokox commented Sep 30, 2023

Same for me (Only starting Firefox)
Fedora 38
Selenium Server 4.13.0
EDIT: Selenium Server 4.0.0 too
EDIT: Idk what is GET request to /session/<session-id> supposed to do, but python selenium webdriver does not do such request

@dczaretsky
Copy link

dczaretsky commented Nov 22, 2023

I'm seeing the same issue on my end. Is there a fix for this?

I'm running Ubuntu 22.04.1
I've tried both Selenium 4.0 and the latest 4.15.

What I've noticed is I see a similar message in the python webdriver library if I don't supply the "execution_path" parameter to the Service object. This is different than the binary location. However, there is no place to supply this in this library.

@0xVZ
Copy link

0xVZ commented Nov 25, 2023

@tokox @dczaretsky I tried almost every version of selenium server from the last 3.X iterations to the latest, seems to not work at all, any news or idea how to solve this? maybe rolling back to a old commit of webdriverxx?

@0xVZ
Copy link

0xVZ commented Nov 25, 2023

SOLVED!
I did a checkout of 0b04c44 and all runned smooth, just a couple of comments in the CMakeLists.txt of the example to compile on linux and firefox works and goes to DuckDuckGo without a problem.

So the current working is commit 0b04c44 with selenium-server-4.0.0-beta-4.jar standalone

@dczaretsky
Copy link

@0xVZ thanks for sharing! I did checkout this commit but I'm still having trouble getting this to run on Ubuntu with the selenium-server-4.0.0-beta-4.jar. The error I keep getting is the following upon startup. Have you run into this? Any thoughts?

WebDriver Error: at line 202, file /usr/local/include/webdriverxx/webdriverxx/detail/resource.h called from ProcessResponse (HTTP code: 500, body: {
"value": {
"additionalInformation": "Driver info: driver.version: unknown",
"localizedMessage": "Could not start a new session. Error while creating session with the driver service. Stopping driver service: Driver server process died prematurely.\nBuild info: version: '4.0.0-beta-4', revision: '29f46d02dd'\nSystem info: host: 'XXXXXXXXXX', ip: 'XXXXXXXXXX', os.name: 'Linux', os.arch: 'amd64', os.version: '6.2.0-1016-azure', java.version: '19.0.2'\nDriver info: driver.version: unknown\nBuild info: version: '4.0.0-beta-4', revision: '29f46d02dd'\nSystem info: host: 'XXXXXXXXXX', ip: 'XXXXXXXXXX', os.name: 'Linux', os.arch: 'amd64', os.version: '6.2.0-1016-azure', java.version: '19.0.2'\nDriver info: driver.version: unknown",
"systemInformation": "System info: host: 'XXXXXXXXXX', ip: 'XXXXXXXXXX', os.name: 'Linux', os.arch: 'amd64', os.version: '6.2.0-1016-azure', java.version: '19.0.2'",
"supportUrl": null,
"cause": null,

@0xVZ
Copy link

0xVZ commented Nov 27, 2023

@dczaretsky odd... i would try doing the checkout, making sure the current HEAD is at the commit, build and grab the error and see if the error is different that what you got building from the last commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants