Skip to content
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

how to use three iframe #1272

Closed
limengtaylor opened this issue Aug 4, 2022 · 5 comments
Closed

how to use three iframe #1272

limengtaylor opened this issue Aug 4, 2022 · 5 comments
Assignees
Labels

Comments

@limengtaylor
Copy link

image
when the web have 3 or more iframe ,how to get the dom to use click,hover,upload;

@ruthtxh ruthtxh self-assigned this Aug 4, 2022
@ruthtxh ruthtxh added the query label Aug 4, 2022
@ruthtxh
Copy link
Collaborator

ruthtxh commented Aug 4, 2022

Hi @limengtaylor what is the error message you're getting? Are you able to share the website so we can take a look please?

@limengtaylor
Copy link
Author

limengtaylor commented Aug 5, 2022

Hi @limengtaylor what is the error message you're getting? Are you able to share the website so we can take a look please?

image
The picture is the error message;
the element in the third iframe can't be finded;
In the function Chrome.withFrame,there are mainframe_context and subframe_context,if the webpage hava the iframe more 2 level,how to click the elements?
image

@ruthtxh
Copy link
Collaborator

ruthtxh commented Aug 11, 2022

Hi @limengtaylor currently there is only support for 2 layers of iframes, can you share your website so we can see if there is a workaround for your scenario?

You can try this and see if it works for you, by accessing the first iframe via the url directly.

@limengtaylor
Copy link
Author

Hi @limengtaylor currently there is only support for 2 layers of iframes, can you share your website so we can see if there is a workaround for your scenario?

You can try this and see if it works for you, by accessing the first iframe via the url directly.

I use 'dom' made a three iframes tag,and how to solve more than 3 iframes,4 iframes ,5 iframes,some old Intranet there are so many iframes.
https://www.antdv.com/components/button
wait 5
dom begin
var dom1 = document.querySelector('#header');
var frame1 = document.createElement("iframe");
frame1.setAttribute('id','mainFrame');
frame1.setAttribute('src','https://www.antdv.com/docs/vue/introduce-cn');
frame1.style.width='1100px';
frame1.style.height='1200px';
frame1.style.display='block';
dom1.append(frame1);
dom finish
wait 10
dom begin
console.log('dom2',document.getElementsByTagName("iframe")['mainFrame'].contentDocument)
var dom2 = document.getElementsByTagName("iframe")['mainFrame'].contentDocument.querySelector('#header');
var frame2 = document.createElement("iframe");
frame2.setAttribute('id','subFrame');
frame2.setAttribute('src','https://www.antdv.com/components/overview-cn/');
frame2.style.width='900px';
frame2.style.height='1000px';
frame2.style.display='block';
dom2.append(frame2);
dom finish
wait 10
dom begin
var dom3 = document.getElementsByTagName("iframe")['mainFrame'].contentDocument.getElementsByTagName("iframe")['subFrame'].contentDocument.querySelector('#app > div > div > div > section.main-container > section > div:nth-child(6) > h2');
var iframe3 = document.createElement("iframe");
iframe3.setAttribute('id','sunFrame');
iframe3.setAttribute('src','https://www.antdv.com/components/table-cn');
iframe3.style.width='700px';
iframe3.style.height='700px';
iframe3.style.display='block';
dom3.append(iframe3);
dom finish
wait 10
frame mainFrame
frame subFrame
frame sunFrame
dom console.log(document.getElementsByTagName("iframe")['mainFrame'].contentDocument.getElementsByTagName("iframe")['subFrame'].contentDocument.getElementsByTagName("iframe")['sunFrame'].contentDocument.querySelector('body > div.drawer-wrapper > div > div.ant-drawer-content-wrapper > div:nth-child(2) > div > span > svg'))
click body > div.drawer-wrapper > div > div.ant-drawer-content-wrapper > div:nth-child(2) > div > span > svg
wait 50

@kensoh
Copy link
Member

kensoh commented Aug 19, 2024

Closing but please ping back if this is still relevant or an issue.

@kensoh kensoh closed this as completed Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants