Selenium Recording Problem with Bootstrap Tag Input

Selenium recording will not capture the  behaviour of Bootstrap tag input.

Screen Shot 2015-02-19 at 4.23.47 PM

Image 1

You need to type the word that need to be insert to the Bootstrap  tag input. It looks like Image 2  after typing. 

Screen Shot 2015-02-19 at 4.24.05 PM

Image 2

Then you have to press Enter/Return key. So then only  the word will insert as a Tag(Image 3)

Screen Shot 2015-02-19 at 4.24.15 PM

Image 3

If you use selenium to record the above scenario  and  then if you playback the recorded script, It will not reach to the status of Image 3. It will  reach only to the status of Image 2.

Recorded command will look like this:  driver.findElement(By.xpath(XPATH)).sendKeys(TAGNAME);

The reason for this problem is selenium did not capture action of clicking the enter key.

If selenium Enter key action command added after above command, It will  create a another problem. Because it will try the  submit the form in that current page, also it will not add the tag to the Bootstrap Tage Input.

To over come this problem “\n”(New line) is need to be added next to the world need to be insert.

so correct command is: driver.findElement(By.xpath(XPATH)).sendKeys(TAGNAME+”\n);

Leave a Reply

Your email address will not be published. Required fields are marked *