Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

372
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda