Here is the tag of document place under
<iframe height="900" width="100%" src="/attachments/download/Attachment.pdf" title="document"/>
Here is the tag of document place under
<iframe height="900" width="100%" src="/attachments/download/Attachment.pdf" title="document"/>
An inline frame is a construct which embeds a document into an HTML document so that embedded data is displayed inside a subwindow of the browser's window. This does not mean full inclusion and the two documents are independent, and both them are treated as complete documents, instead of treating one as part of the other.
You can find a detailed discussion in Ways to deal with #document under iframe.
Now as per best practices to switch to an iframe you have to:
Induce WebDriverWait for the desired frame to be available and switch to it and you can use either of the following solutions:
Using cssSelector
:
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe[src='/attachments/download/Attachment.pdf'][title='document']")));
Using xpath
:
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@src='/attachments/download/Attachment.pdf' and @title='document']")));
Once you switch to the proper <iframe>
you can scroll as well as interact with any element within the <iframe>