Skip to content

[js] fix: return statement in submit()#11883

Merged
titusfortner merged 2 commits intoSeleniumHQ:trunkfrom
TamsilAmani:js-submit-return
Apr 18, 2023
Merged

[js] fix: return statement in submit()#11883
titusfortner merged 2 commits intoSeleniumHQ:trunkfrom
TamsilAmani:js-submit-return

Conversation

@TamsilAmani
Copy link
Copy Markdown
Contributor

@TamsilAmani TamsilAmani commented Apr 11, 2023

Description

The value evaluated by the submit() was not being returned.

Motivation and Context

Help developers who use selenium to get correct result.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@TamsilAmani TamsilAmani requested a review from harsha509 April 11, 2023 17:00
@harsha509
Copy link
Copy Markdown
Member

Makes sense!

Thank you @TamsilAmani !

harsha509
harsha509 previously approved these changes Apr 11, 2023
Copy link
Copy Markdown
Member

@harsha509 harsha509 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @TamsilAmani !

@titusfortner
Copy link
Copy Markdown
Member

What result are we expecting from submit? It's an action on the browser, so the return should be null

@harsha509 harsha509 dismissed their stale review April 11, 2023 17:49

Checked the code again after @titusfortner comment, looks like it is only returning null. Do you have any use case tamsil ?

@swrdfish
Copy link
Copy Markdown

swrdfish commented Apr 11, 2023

@titusfortner @harsha509
Thank you for looking into this.

I stumbled upon this bug while working on Nightwatch. The problem is that .submit() is supposed to return a promise, which can be used to wait for the command to complete. Without the promise we cannot ensure that subsequent actions behave deterministically. It is not the value we are interested in but the promise to let us know when the command has finished.

@titusfortner titusfortner merged commit 395a926 into SeleniumHQ:trunk Apr 18, 2023
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

Successfully merging this pull request may close these issues.

4 participants