-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[js] switchTo().window() should use a 'handle' parameter rather than name
#2718
[js] switchTo().window() should use a 'handle' parameter rather than name
#2718
Conversation
* @param {number} opt_searchAttempt Which attempt this is at finding the | ||
* window to switch to. | ||
*/ | ||
nsCommandProcessor.prototype.switchToWindow = function(response, parameters, | ||
opt_searchAttempt) { | ||
var lookFor = parameters.name; | ||
var lookFor = parameters.handle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/javascript/firefox-driver is the Selenium implementation of a WebDriver for Firefox. Since it generally isn’t W3C compatible, it shouldn’t change.
We can just drop this change.
…'name'. This is to match the W3C Webdriver spec.
9661af0
to
5ebb924
Compare
@andreastt Thank you for the hints, I've undone the webdriver for Firefox change, and added the W3C compliance detection. I also worked out how to run the nodejs tests, and I've added a couple of test cases to test that the parameter and w3c detection works correctly. For reference, cd into |
r? @jleyba |
@@ -1654,9 +1654,10 @@ class TargetLocator { | |||
* when the driver has changed focus to the specified window. | |||
*/ | |||
window(nameOrHandle) { | |||
let paramName = this.driver_.getExecutor().w3c ? 'handle' : 'name'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather just send the parameter twice than break encapsulation here. There's already precedence with webelement IDs
Looks like we're missing e2e coverage for window switching in Mind adding a test or 2? |
…. Add a functional test.
@jleyba It took a bit of work, but I've now added a test, it seems to work fine. |
X
in the preceding checkbox, I verify that I have signed the Contributor License AgreementThis is to match the W3C Webdriver spec, and fixes
switchTo().window()
for use with geckodriver.Note that the python driver already uses
handle
rather thanname
I've tried running the tests locally, but either they are taking a very long time, or there's something wrong with them on my machine.