-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cypress Screenshots not properly targeting elements in iFrame #14283
Comments
We're not aware of any issues exactly like this. Can you provide a reproducible example or a sample use case of the issue with some basic HTML / CSS / etc? We can't really track this down without that - since I'm not familiar with the application under test - I can't exactly see what this element is you're screenshotting also. Thanks! |
The html is consist of the cypress iframe. But within that iframe is another iframe and that is the area I want to take a screenshot of. I'll try to make an example. Do you know if the screenshooting has any issues with iframes? |
I updated my question |
I'm not aware of any issues with screenshotting an iframe within Cypress. I'm also not completely sure what you mean by 'offset' in the situation. Can you provide a reproducible example that we can run? We'll have to close this issue if we can't reproduce it. This does not mean that your issue is not happening - it just means that we do not have a path to move forward. |
<body>
<div style="height:100px;">
something
</div>
<iframe data-tid="embeddedPageContainerIframe" src="https://www.slickdeals.com/" height="100%" width="100%" title="Iframe Example"></iframe>
</body> In the code snippet above, if you were to run the following test scenario: describe('My Test', () => {
// eslint-disable-next-line jest/expect-expect
it('should be accessible', () => {
cy.visit(
``
);
cy.getAppIframeBody().as('learningApp').find("#globalBar").screenshot();
});
}); |
Hey @jennifer-shehane, is the above sufficient to provide some context into the problem? |
Can you provide the |
Hi, I also have this issue. Here is the command chain I tried to use: Code to reproduce: cy.get("css-path-to-iframe iframe") Actual result: Expected Result: System Details: Other Details: |
I'm facing the same issue with Cypress 9.3.1 running Chrome 97.
Our getIframeBody method:
|
I'm facing an issue also with |
I have the same (screenshot) problem. also clicking elements inside an iframe does not seem to work. |
Good day! |
Any solution here? |
Does anyone fix this? |
This is an issue. It can be reproduced like shown below: Test code it('screenshot element within iframe', () => {
cy.visit('index.html');
cy.get('iframe')
.its('0.contentDocument.body')
.should('not.be.empty')
.then((body) => cy.wrap(body))
.find("#foo").screenshot();
}); index.html <body>
<div style="height:100px;">
Main Page
</div>
<iframe src="iframe.html"></iframe>
</body> iframe.html <html>
<body>
<div id="foo">Foo</div>
Iframe content
</body>
</html> The screenshot only screenshots the main content in index.html and does not screenshot the content within the iframe. I would expect this task to be a part of full iframe support. I don't know the effort to fix this and this is not work we are prioritizing at the moment. This issue will be updated when work is planned. We're open to any PRs to make this work. |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Hi.
I didn't think my question accurately described what was going on so I refined it.
With the cypress screenshot feature, I am having trouble taking images of elements inside of a second iframe in addition to the iframe that cypress set it. Basically having trouble with iframes.
Below shows an attempt to take a picture of an image in an iframe, but the offset seems to be the amount of height and width of anything outside of the iframe. The coordinates of the shot seems to be relative to the outer iframe (the whole image) instead of relative to the inside iframe that the elemnts are contained inside of.
Is there any ongoing issue related to this?
The text was updated successfully, but these errors were encountered: