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

426
Visualizações
Bootstrap Modal Dialog Disappears upon clicking in automation (Selenium)

I am using Selenium to automate a website interaction through ChromeDriver and .NET C#. The website contains a bootstrap modal dialog as seen in the screen shot. Clicking on the company name in each row will download the company profile PDF document (a child browser window will open for the download).

Human interaction with the website works perfectly. Also, if I run $("div.modal-dialog table>tbody>tr>td")[2].firstElementChild.click(); in Chrome's dev tool console, it also downloads the PDF properly.

But running this line of code in Selenium like this (IJavaScriptExecutor)driver).ExecuteScript(@"$(""div.modal-dialog table>tbody>tr>td"")[2].firstElementChild.click();"); will cause the modal dialog to disappear immediately and no PDF is downloaded.

Selenium is able to find the element at $("div.modal-dialog table>tbody>tr>td")[2].firstElementChild, which I tested in the code, so I'm pretty sure.

I think the automation process is clicking in the main window, not on the modal dialog, causing the latter to disappear immediately. But how to switch to a bootstrap modal popup in Selenium?

Or is it some other problem? Any thoughts? This issue is driving me nuts. Thank you very much in advance.

enter image description here

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