Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
Appium [ Javascript ] [WD] - Scroll to an element which is not visible but enabled or clickable

I am using appium javascript client with uiautomator2 as the automation engine for android. In one of screen having multiple buttons like Button 1, Button 2, Button 3 ...etc stacked horizantal with scroll. However, only first two buttons will be visible on page load [ Refer Screen shot].

I want to click on button 4. Have implemented below code to handle scroll and click button but I am unable to break loop since attribute is always false.

            var element = await driver.elementByXPath("//android.widget.Button[contains(@text,'Button 4')]");
            var scrollFromElement = await driver.elementByXPath("//android.widget.Button[contains(@text,'Button 2')]");

            var isEleFocused = await element.getAttribute("focused");
            console.log("concierge element is Focused - " + isEleFocused);

            if (isEleFocused == "false")
            {
                var i = 0;
                do{
                    await swipeElementAndroid(scrollFromElement, "RIGHT")
                    var d1 = await element.getAttribute("focused");
                    if(d1 == "true"){
                        i=10
                        break;
                    }
                    else{
                        await swipeElementAndroid(scrollFromElement, "RIGHT")
                        i=i+1
                        console.log("i="+i)
                    }   
                }while(i<5)
            }       
            
            await sleepwait(500)
            console.log("after scroll- if condition")

            e1 = await driver.elementByXPath("//android.widget.Button[contains(@text,'Button 4')]")
            await e1.click()

Kindly suggest alternative way to handle the same.

Note: Attributes like displayed, clickable are always true even though button is not visible.

enter image description here

enter image description here

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda