Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

418
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!