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

Add support for different selectors in WebDriver::submitForm #3560

Merged
merged 1 commit into from Oct 3, 2016

Conversation

Projects
None yet
3 participants
@imjoehaines
Contributor

imjoehaines commented Sep 29, 2016

Hi

We've been updating some acceptance tests to use the submitForm method, but have hit an issue where some of our buttons don't have a name attribute so submitForm can't find them. We've been getting around this by adding names to the buttons that were missing them, but it would be nice to be able to find the button through different means so that we don't have to change our code just to write a test.

This PR adds support for strict selectors (e.g. ['id' => 'foo']) and instances of WebDriverBy to be passed to WebDriver::submitForm as the $button parameter, so that the buttons can be found by more methods than just name.

For example, with the following HTML:

<input type="submit" id="submit" name="submitButton" value="Submit" />

$button could be any one of the following:

  • 'submitButton'
  • ['id' => 'submit']
  • WebDriverBy::cssSelector('input[name="submitButton"]')

Or any other valid strict locator or WebDriverBy.

The existing behaviour should be unchanged so this won't cause any backwards incompatibility issues.

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Oct 2, 2016

Member

Please make a pull request to 2.2 branch instead.

Member

Naktibalda commented Oct 2, 2016

Please make a pull request to 2.2 branch instead.

@imjoehaines imjoehaines changed the base branch from master to 2.2 Oct 2, 2016

Add support for different selectors in submitForm
Buttons can now be found with strict selectors or WebDriverBy instances
@imjoehaines

This comment has been minimized.

Show comment
Hide comment
@imjoehaines

imjoehaines Oct 2, 2016

Contributor

Hi @Naktibalda, updated :)

Contributor

imjoehaines commented Oct 2, 2016

Hi @Naktibalda, updated :)

@Naktibalda

Thanks, I think that it is a useful feature.

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Oct 3, 2016

Member

Looks very good. Thank you!

Member

DavertMik commented Oct 3, 2016

Looks very good. Thank you!

@DavertMik DavertMik merged commit 3dfc247 into Codeception:2.2 Oct 3, 2016

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details

chris1312 added a commit to chris1312/Codeception that referenced this pull request Jun 16, 2017

Add support for different selectors in submitForm (#3560)
Buttons can now be found with strict selectors or WebDriverBy instances
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment