piątek, 29 września 2023

How to start session in selenium hub 4 using REST api?

curl -v -X POST \
  -H "Content-Type: application/json" \
  -d '{
"capabilities":
{
	"firstMatch":
	[
	{
		"acceptInsecureCerts": true,
		"browserName": "chrome",
		"goog:chromeOptions":
		{
			"args":
			[
			"--remote-allow-origins=*",
			"--remote-debugging-port=9222"
			],
			"extensions":
			[]
		},
		"platformName": "linux"
	}
	]
}
}' \
  http://127.0.0.1:4444/wd/hub/session

Replace "127.0.0.1" with your selenium host and "4444" with your port.

I figured that parameter "--remote-debugging-port=9222" is required in newer Chrome. Without it - starting of session fails.

PS. please leave a comment if you find this post useful.