Class WebElementWrapper
- java.lang.Object
-
- io.github.commonslibs.selenium_lib.utilidades.WebElementWrapper
-
public class WebElementWrapper extends Object
Clase que contiene las funcionalidades de selenium encapsulada, para usarlo de manera mas sencilla- Author:
- AGAPA
-
-
Constructor Summary
Constructors Constructor Description WebElementWrapper(org.openqa.selenium.WebDriver driver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.openqa.selenium.WebElementclick(org.openqa.selenium.By testObject)Acción de hacer click en un elemento identificado por el @param testObject.voidclickParaUploadFichero(org.openqa.selenium.By testObject, String rutaFichero)Click para subir un fichero.org.openqa.selenium.WebElementclickSinColorear(org.openqa.selenium.By testObject)intcuentaNumeroDeOpcionesEnSelect(org.openqa.selenium.By testObject)Devuelve el numero de opciones presentes en el select cuyo objeto de test se pasa como parametro.voiddoubleClick(org.openqa.selenium.By testObject)Acción de hacer doble click en un elemento identificado por el @param testObject.voidescribeTexto(org.openqa.selenium.By testObject, String texto)Acción de escribir texto en un elemento identificado por el @param testObject.org.openqa.selenium.WebElementesperaBasica(org.openqa.selenium.By testObject)voidesperaIncondicional(int segundos)voidesperaIncondicionalMilisegundos(int milisegundos)voidesperarDesaparezcaElemento(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elemento)voidesperarDesaparezcaProcesando(org.openqa.selenium.WebDriver driver)voidesperarFilaUnicaListado(org.openqa.selenium.By testObject)voidesperarHastaQueElementoNoPresente(org.openqa.selenium.By testObject)voidesperarListadoConFilas(org.openqa.selenium.By testObject, int numeroFilasEsperadas)StringgetAttribute(org.openqa.selenium.By testObject, String atributo)StringgetText(org.openqa.selenium.By testObject)voidinputUploadFichero(org.openqa.selenium.By inputTestObject, String rutaFichero)Input upload fichero.voidmostrarElementoPresente(org.openqa.selenium.By testObject)Acción de resaltar un elemento con un color determinado en el navegador si éste esta presente.org.openqa.selenium.WebElementobtenerElemento(org.openqa.selenium.By testObject)intobtenerFilaConTextoEnTabla(org.openqa.selenium.By testObject, String texto)Obtiene la fila de una tabla que contiene el @param texto en alguna de sus columnas.intobtenerNumeroRegistrosTabla(org.openqa.selenium.By tabla)Devuelve el nº de elementos de la @param tablaStringobtenerTextoElemento(org.openqa.selenium.By testObject)Comprueba si el elemento extiste y luego obtiene el texto.intobtieneNumeroDeFilasListado(org.openqa.selenium.By testObject)StringobtieneValorSeleccionadoEnCombo(org.openqa.selenium.By testObject, String selector)voidscrollTopPagina()Posicionar en porsición más alta de la páginavoidseleccionaDesplegableByLabel(String idDivSelect, String labelBuscada)voidseleccionaDesplegableByLabel(String labelBuscada, org.openqa.selenium.By label, org.openqa.selenium.By filtro)voidseleccionarElementoCombo(org.openqa.selenium.By testObject, String labelValue)Acción de seleccionar un elemento con etiqueta @param labelValue de un combo (select desplegable) identificado por el @param testObject.voidseleccionarElementoComboConEspera(org.openqa.selenium.By testObject, String labelValue)Acción de seleccionar un elemento con etiqueta @param labelValue de un combo (select desplegable) identificado por el @param testObject, incluye una comprobación para verificar de que el elemento a desaparecido.voidselectOptionByIndex(org.openqa.selenium.By testObject, Integer index)voidselectOptionByLabel(org.openqa.selenium.By testObject, String label)voidselectOptionByValue(org.openqa.selenium.By testObject, String value)voidverifyElementAttributeValue(org.openqa.selenium.By testObject, String atributo, String value)voidverifyElementChecked(org.openqa.selenium.By testObject)voidverifyElementNotChecked(org.openqa.selenium.By testObject)voidverifyElementNotPresent(org.openqa.selenium.By testObject)voidverifyElementPresent(org.openqa.selenium.By testObject)booleanverifyElementPresentWithReturn(org.openqa.selenium.By testObject)booleanverifyElementPresentWithReturn(org.openqa.selenium.By testObject, int numeroDeIntentos)voidverifyElementText(org.openqa.selenium.By testObject, String text)booleanverifyElementVisibleWithReturn(org.openqa.selenium.By testObject)voidverifyOptionSelectedByLabel(org.openqa.selenium.By testObject, String label)voidwaitUntilElementTextChangedOrDisapeared(org.openqa.selenium.By testObject, String text)Realiza una espera activa mientras exista el @param testObject con el @textoAComprobar.
-
-
-
Method Detail
-
seleccionarElementoComboConEspera
public void seleccionarElementoComboConEspera(org.openqa.selenium.By testObject, String labelValue) throws PruebaAceptacionExcepcionAcción de seleccionar un elemento con etiqueta @param labelValue de un combo (select desplegable) identificado por el @param testObject, incluye una comprobación para verificar de que el elemento a desaparecido.- Parameters:
testObject- , objeto combolabelValue- , etiqueta que se quiere seleccionar del combo- Throws:
PruebaAceptacionExcepcion- si se produce un error sobre el combo que se indica
-
seleccionarElementoCombo
public void seleccionarElementoCombo(org.openqa.selenium.By testObject, String labelValue) throws PruebaAceptacionExcepcionAcción de seleccionar un elemento con etiqueta @param labelValue de un combo (select desplegable) identificado por el @param testObject.- Parameters:
testObject- , objeto combolabelValue- , etiqueta que se quiere seleccionar del combo- Throws:
PruebaAceptacionExcepcion- si se produce un error a la hora de seleccionar un elemento en el combo
-
click
public org.openqa.selenium.WebElement click(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcionAcción de hacer click en un elemento identificado por el @param testObject.- Parameters:
testObject- , objeto donde se hace click- Returns:
- elemento elemento
- Throws:
PruebaAceptacionExcepcion- si se produce error al hacer click en el objeto que se indica
-
clickSinColorear
public org.openqa.selenium.WebElement clickSinColorear(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
doubleClick
public void doubleClick(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcionAcción de hacer doble click en un elemento identificado por el @param testObject.- Parameters:
testObject- , objeto donde se hace doble click- Throws:
PruebaAceptacionExcepcion- si se produce error al hacer doble click en el objeto que se indica
-
mostrarElementoPresente
public void mostrarElementoPresente(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcionAcción de resaltar un elemento con un color determinado en el navegador si éste esta presente.- Parameters:
testObject- , objeto que se quiere resaltar- Throws:
PruebaAceptacionExcepcion- si el elemento que se quiere resaltar no se encuentra
-
escribeTexto
public void escribeTexto(org.openqa.selenium.By testObject, String texto) throws PruebaAceptacionExcepcionAcción de escribir texto en un elemento identificado por el @param testObject.- Parameters:
testObject- , objeto al que se le quiere indicar un textotexto- , texto que se quiere indicar en el campo de texto- Throws:
PruebaAceptacionExcepcion- si se produce error al intentar escribir el texto en el objeto en cuestion
-
selectOptionByIndex
public void selectOptionByIndex(org.openqa.selenium.By testObject, Integer index) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
selectOptionByLabel
public void selectOptionByLabel(org.openqa.selenium.By testObject, String label) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
verifyOptionSelectedByLabel
public void verifyOptionSelectedByLabel(org.openqa.selenium.By testObject, String label) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
selectOptionByValue
public void selectOptionByValue(org.openqa.selenium.By testObject, String value) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
obtieneValorSeleccionadoEnCombo
public String obtieneValorSeleccionadoEnCombo(org.openqa.selenium.By testObject, String selector) throws PruebaAceptacionExcepcion
- Throws:
PruebaAceptacionExcepcion
-
verifyElementText
public void verifyElementText(org.openqa.selenium.By testObject, String text) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
waitUntilElementTextChangedOrDisapeared
public void waitUntilElementTextChangedOrDisapeared(org.openqa.selenium.By testObject, String text) throws PruebaAceptacionExcepcionRealiza una espera activa mientras exista el @param testObject con el @textoAComprobar. Puede provocar un bloqueo, así que usarlo con cuidado- Parameters:
testObject- objetotext- texto que se quiere comprobar- Throws:
PruebaAceptacionExcepcion- si se produce un error
-
verifyElementPresentWithReturn
public boolean verifyElementPresentWithReturn(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
verifyElementPresentWithReturn
public boolean verifyElementPresentWithReturn(org.openqa.selenium.By testObject, int numeroDeIntentos) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
verifyElementPresent
public void verifyElementPresent(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
verifyElementNotPresent
public void verifyElementNotPresent(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
verifyElementChecked
public void verifyElementChecked(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
verifyElementNotChecked
public void verifyElementNotChecked(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
getAttribute
public String getAttribute(org.openqa.selenium.By testObject, String atributo) throws PruebaAceptacionExcepcion
- Throws:
PruebaAceptacionExcepcion
-
verifyElementAttributeValue
public void verifyElementAttributeValue(org.openqa.selenium.By testObject, String atributo, String value) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
clickParaUploadFichero
public void clickParaUploadFichero(org.openqa.selenium.By testObject, String rutaFichero) throws PruebaAceptacionExcepcionClick para subir un fichero.- Parameters:
testObject- valor para: test objectrutaFichero- valor para: ruta fichero- Throws:
PruebaAceptacionExcepcion- la prueba aceptacion excepcion
-
inputUploadFichero
public void inputUploadFichero(org.openqa.selenium.By inputTestObject, String rutaFichero) throws PruebaAceptacionExcepcionInput upload fichero.- Parameters:
inputTestObject- valor para: input test objectrutaFichero- valor para: ruta fichero- Throws:
PruebaAceptacionExcepcion- la prueba aceptacion excepcion
-
getText
public String getText(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion
- Throws:
PruebaAceptacionExcepcion
-
cuentaNumeroDeOpcionesEnSelect
public int cuentaNumeroDeOpcionesEnSelect(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcionDevuelve el numero de opciones presentes en el select cuyo objeto de test se pasa como parametro.- Parameters:
testObject- objeto de test consdierado.- Returns:
- el numero de opciones presentes en el select cuyo objeto de test se pasa como parametro.
- Throws:
PruebaAceptacionExcepcion- para la prueba de aceptacion
-
obtenerFilaConTextoEnTabla
public int obtenerFilaConTextoEnTabla(org.openqa.selenium.By testObject, String texto) throws PruebaAceptacionExcepcionObtiene la fila de una tabla que contiene el @param texto en alguna de sus columnas. Las filas están numeradas de 0 en adelante. Si no encuentra el texto en ninguna fila, devuelve -1.- Parameters:
testObject- valor para: Locator del elemento tablatexto- valor para: texto- Returns:
- int numero de la fila
- Throws:
PruebaAceptacionExcepcion- la prueba aceptacion excepcion
-
obtieneNumeroDeFilasListado
public int obtieneNumeroDeFilasListado(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
esperarFilaUnicaListado
public void esperarFilaUnicaListado(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
esperarListadoConFilas
public void esperarListadoConFilas(org.openqa.selenium.By testObject, int numeroFilasEsperadas) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
esperaIncondicional
public void esperaIncondicional(int segundos)
-
esperaIncondicionalMilisegundos
public void esperaIncondicionalMilisegundos(int milisegundos)
-
scrollTopPagina
public void scrollTopPagina()
Posicionar en porsición más alta de la página
-
obtenerNumeroRegistrosTabla
public int obtenerNumeroRegistrosTabla(org.openqa.selenium.By tabla) throws PruebaAceptacionExcepcionDevuelve el nº de elementos de la @param tabla- Parameters:
tabla- , identificador de la tabla de la que se quiere tener el nº de registros- Returns:
- nº de registros de la @param tabla
- Throws:
PruebaAceptacionExcepcion- prueba de aceptacion
-
esperarHastaQueElementoNoPresente
public void esperarHastaQueElementoNoPresente(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
esperarDesaparezcaProcesando
public void esperarDesaparezcaProcesando(org.openqa.selenium.WebDriver driver) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
esperarDesaparezcaElemento
public void esperarDesaparezcaElemento(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elemento) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
esperaBasica
public org.openqa.selenium.WebElement esperaBasica(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
obtenerTextoElemento
public String obtenerTextoElemento(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion
Comprueba si el elemento extiste y luego obtiene el texto. El obejeto no tiene porque estar presente.- Parameters:
testObject- identificador del objeto- Returns:
- si no existe el elemento devuelve "", sino el valor.
- Throws:
PruebaAceptacionExcepcion- para la prueba de aceptacion
-
verifyElementVisibleWithReturn
public boolean verifyElementVisibleWithReturn(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
obtenerElemento
public org.openqa.selenium.WebElement obtenerElemento(org.openqa.selenium.By testObject) throws PruebaAceptacionExcepcion- Throws:
PruebaAceptacionExcepcion
-
seleccionaDesplegableByLabel
public void seleccionaDesplegableByLabel(String idDivSelect, String labelBuscada) throws PruebaAceptacionExcepcion
- Throws:
PruebaAceptacionExcepcion
-
seleccionaDesplegableByLabel
public void seleccionaDesplegableByLabel(String labelBuscada, org.openqa.selenium.By label, org.openqa.selenium.By filtro) throws PruebaAceptacionExcepcion
- Throws:
PruebaAceptacionExcepcion
-
-