Search code examples
c#selenium-webdriverbrowser-automationchrome-web-driver

How can I make Selenium click 'Open' on a PDF download page using C# and handle the iframe selection?


Unable to click open in pdf download page using C# selenium. how to make the driver understand the iframe and make the selection?

PDF download page

enter image description here

Selenium code I tried:

   driver.SwitchTo().Window(driver.WindowHandles.Last());
   driver.SwitchTo().Frame(0);
   driver.FindElement(By.LinkText("Open")).Click();

Facing this issue:

enter image description here


Solution

  • When you have a child frame in your case asking for a password but you are active in a parent frame you will not see changes nor be able to access the PDF viewers contents you can only change your own surroundings

    enter image description here

    What is odd about your image is there should be a modal Password request to open a secured PDF.

    enter image description here