Selenide - problem autocomplete text fields

117 views
Skip to first unread message

elkingut

unread,
Jun 30, 2016, 9:12:15 AM6/30/16
to selenide
Hi,

I have a problem with my application using selenide+cucumber, when I try to send the value at text fields of autocomplete not taking full value, for example: I send value ABASTOS and only recognize the text ABOS or in the case of number I send 201689876 and only recognize 276. The text field only can be selected when I press enter, I tried in the following ways:

_________________________________________________

@Dado("^digito en el nuevo campo Demandantes \"([^\"]*)\"$")
public void digito_en_el_nuevo_campo_Demandantes(String arg1) throws Throwable {

   home.getCampoAdicionalDemandantes().setValue(arg1);
   home.getCampoAdicionalDemandantes().pressEnter();
}

_________________________________________________

@Dado("^digito en el nuevo campo Demandados \"([^\"]*)\"$")
public void digito_en_el_nuevo_campo_Demandados(String arg1) throws Throwable {
   
   home.getCampoAdicionalDemandados().sendKeys(arg1,Keys.ENTER);
}

_________________________________________________

@Dado("^digito en el nuevo campo Demandados \"([^\"]*)\"$")
public void digito_en_el_nuevo_campo_Demandados(String textoDemandantes) throws Throwable {

home.setCampoDemandantes(textoDemandantes).waitUntil(exist, 10000);
home.getCampoDemandantes().setValue(textoDemandantes).sendKeys(Keys.ARROW_DOWN, Keys.ENTER);

       }
_________________________________________________

@Cuando("^digito en el campo Demandados \"([^\"]*)\" seleccionando \"([^\"]*)\"$")
public void digito_en_el_campo_Demandados(String textoDemandados, String seleccion) throws Throwable {
home.getCampoDemandados().clear();
home.getCampoDemandados().selectOptionByValue(seleccion);
}
_________________________________________________



But, none of them works.

I appreciate your help.

This is the image:




Cordially,

ELKIN GUTIERREZ

Andrei Solntsev

unread,
Jun 30, 2016, 10:49:31 AM6/30/16
to elkingut, selenide
Hi Elkin!
When you need autosuggestion, I recommend using "$.sendKeys()" instead of "$.setValue()".
It emulates real user actions, so it should work better with autocompletion.

Andrei Solntsev

--
You received this message because you are subscribed to the Google Groups "selenide" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenide+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

elkingut

unread,
Jun 30, 2016, 1:10:16 PM6/30/16
to selenide, elki...@gmail.com
Thank you !!!

With sendKeys + add validation Thread.sleep(50) I can capture all the values in the textfields:

String[] aCaracteres = arg1.split("");
for (int x=0;x<aCaracteres.length;x++){
 System.out.println("[" + x + "] " + aCaracteres[x]);
home.getCampoAdicionalDemandados().sendKeys(new String(aCaracteres[x]));
Thread.sleep(50);
}
   home.getCampoAdicionalDemandados().sendKeys(Keys.ENTER);
Reply all
Reply to author
Forward
0 new messages