Codeception: clear form field with codeception

Created on 3 Jan 2018  路  4Comments  路  Source: Codeception/Codeception

What are you trying to achieve?

I want to clear a form field with codeception.

What do you get instead?

$I->clearField('#example'); currently not supported.

Details

Facebook Webdriver supported currently the clear() method. Example:
$this->webDriver->findElement(WebDriverBy::id('#amount"]'))->clear();

  • Codeception version: 2.3.7
  • PHP Version: 6.4.4
  • Operating System: Win10
  • Installation type: Composer
  • codeception.yml:
paths:
    tests: tests
    output: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs
actor_suffix: Tester
extensions:
    enabled:
        - Codeception\Extension\RunFailed
settings:
    colors: true
  • acceptance.suite.yml:
    bash actor: AcceptanceTester modules: enabled: - \Helper\Acceptance - WebDriver config: WebDriver: url: https://xxxxxxxxxxxxxxxxxx.com browser: chrome window_size: maximize clear_cookies: true)

Most helpful comment

Yes I did. Codeception only fills whitespaces, or doesn't do anything. I will try to fix this problem with my first pull request on github ;)

All 4 comments

Copying my comment from StackOverflow:

Have you tried to use $I->fillField('#amount', ''); ?
I haven't, but this is the only way to achieve this with WebDriver.
If it doesn't work, you are welcome to make a pull request to add clearField method to WebDriver module.

Yes I did. Codeception only fills whitespaces, or doesn't do anything. I will try to fix this problem with my first pull request on github ;)

@eknej thanks, waiting for your pull request then :)
If the php-webdriver has it WebDriver module needs to have it too!

@DavertMik when you Merge this method?

Was this page helpful?
0 / 5 - 0 ratings