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

[🐛 Bug]: Requests for MicrosoftEdge create wrong browser #10410

Closed
andrewnicols opened this issue Mar 4, 2022 · 7 comments
Closed

[🐛 Bug]: Requests for MicrosoftEdge create wrong browser #10410

andrewnicols opened this issue Mar 4, 2022 · 7 comments

Comments

@andrewnicols
Copy link

andrewnicols commented Mar 4, 2022

What happened?

When trying to create new session for Edge with some parameters, I get different sessions. This seems to mostly be either Firefox or Safari, depending on what parameters are passed in. Sometimes I get Edge, but it really seems to vary. I may get Edge five times in a row, but then only Firefox or only Safari.

How can we reproduce the issue?

#!/bin/bash

WDURL="http://localhost:4444/wd/hub";

CAPABILITIES='{"capabilities":{"firstMatch":[{"browserName":"MicrosoftEdge","ms:edgeChromium":true}]},"desiredCapabilities":{"tags":["mandarin.per.nicols.uk","PHP 7.4.28"],"browserName":"MicrosoftEdge","ms:edgeChromium":true,"browser":"edge","ignoreZoomSetting":false,"name":"Behat feature suite"}}'

RESPONSE=`curl -s  -H 'Content-Type: application/json; charset=utf-8' -d "${CAPABILITIES}" "${WDURL}/session"`
SESSIONID=`echo "${RESPONSE}" | python3 -c "import sys, json; print(json.load(sys.stdin)['value']['sessionId'])"`

echo $RESPONSE

echo "Deleting window:"
curl -X DELETE "${WDURL}/session/${SESSIONID}"
echo

Relevant log output

wrongbrowser.log

Operating System

macOS Monterey 12.2.1

Selenium version

4.1.2

What are the browser(s) and version(s) where you see this issue?

Edge 98.0.1108.62

What are the browser driver(s) and version(s) where you see this issue?

edgedriver 98.0.1108.62

Are you using Selenium Grid?

No

@github-actions
Copy link

github-actions bot commented Mar 4, 2022

@andrewnicols, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

When using Selenium 4, do not pass in desiredCapabilities, only capabilities and you do not need ms:edgeChromium, Selenium 4 no longer supports EdgeHTML.

The code above nests desiredCapabilities inside capabilities, the grid ends up translating the request so as to give you the first of 3 matching capabilities. In this case, one of the capabilities is empty, so any available session will work.

Relevant portion of log:

 [Capabilities {}, Capabilities {browserName: MicrosoftEdge, ms:edgeChromium: true}, Capabilities {browser: edge, browserName: MicrosoftEdge, ignoreZoomSetting: false, ms:edgeChromium: true, name: Behat feature suite, tags: [mandarin.per.nicols.uk, PHP 7.4.28]}]

@diemol
Copy link
Member

diemol commented Mar 11, 2022

Thanks for triaging, @titusfortner!
I will reopen this to have this on the bug list, and fix it on the Grid.

@diemol diemol reopened this Mar 11, 2022
@andrewnicols
Copy link
Author

andrewnicols commented Mar 11, 2022 via email

@diemol
Copy link
Member

diemol commented Mar 11, 2022

I'm not a 100% sure. I need to check the commit history to understand why this behavior exists.

@titusfortner
Copy link
Member

The root cause of this particular issue is that you sent an invalid structure with how you nested capabilities.

Selenium should error when this happens rather than defaulting to "use anything." To an extent I don't care since the Selenium libraries can't make this mistake. On the other hand, maybe there are other errors that Selenium library users will experience based on the bug here, so probably worth our looking at it.

@diemol diemol closed this as completed in 676c4cc Mar 12, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2022
elgatov pushed a commit to elgatov/selenium that referenced this issue Jun 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants