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

370
Vistas
How to handle dynamic Elements in Dropdown in Java Selenium

I want to select a values in dropdown. and my problem is. I can't locate the specific element as they are dynamic and they will just appear in the inspect elements Once I choose a value in dropdown.

and I can't right click and inspect element the values in dropdown when the dropdown is open as it will close as soon as I left click.

I also can't use "Select" class as they are embedded in "div" html element

I also can't use "SendKeys" as the dropdown don't have textfield

Here are the codes I tried to use.

//try #1
        driver.findElement(dropDown).click();
        JavascriptExecutor js = (JavascriptExecutor)driver;
        ((WebElement) js.executeScript("document.getElementById('dropwDownID).value='VALUE I WANT'")).click();

note: when I tried this script("document.getElementById('dropwDownID).value='VALUE I WANT') in the console, it returns the value I want.

//try #2
        driver.findElement(dropDown).click();
        WebDriverWait wait = new WebDriverWait(driver, 30);
        wait.until(ExpectedConditions.elementToBeClickable(this_Element_Only_Appear_When_I_Choose_A_Value));

Please see attached picture

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