Integrated icon indicating copy to clipboard operation
Integrated copied to clipboard

Type command doesn't work when using the second time on a field

Open sameerpanjwani opened this issue 10 years ago • 1 comments

I'm trying to test a form which has various onKeyUp and onKeyDown events and also has an Ajax based auto-suggestion text input.

Issue 1 - type command only enters one character when used the second time (Selenium +Firefox)

$this->type('123','number_field')->see('3 characters typed'); //works $this->type('123','number_field')->see('3 characters typed')->type('456','number_field')->see('6 characters typed'); //fails as only "4" gets inputted, i.e. 1234 displays

Issue 2 / Feature Request

It would be great if there were commands like: $this->reType() - re-enter a field's value instead of appending $this->backspace(5) - delete 5 characters from the field $this->seeInElement('text','span#para1') - check if 'text' is there in a span with an id of 'para1'

It's difficult to test my onKeyUp or Ajax based auto-complete otherwise, or is there a better way to go about it that I'm missing?

sameerpanjwani avatar May 13 '15 04:05 sameerpanjwani

You could create a clear method:

public function clear($selector)
{
  $this->findByNameOrId($selector)->clear();
  return $this;
}

Usage:

$this->clear('number_field');

alfredbez avatar Jun 15 '15 16:06 alfredbez