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

FrameID selection broken for framesets? #51

Open
strabbit opened this issue Aug 4, 2017 · 6 comments
Open

FrameID selection broken for framesets? #51

strabbit opened this issue Aug 4, 2017 · 6 comments

Comments

@strabbit
Copy link

strabbit commented Aug 4, 2017

If I have a document that contains a frameset:

<frameset cols="*">
  <frame id="the_frame" name="the_frame" src="frame.html">
</frameset>

And that frame file contains a button:

<button id='the_button'>Click me</button>

I expect the following code to work:

async function navigateWebsite() {
        await browser.init();
        const mainTab = await browser.newTab( { privateTab: false } );
        await mainTab.goTo( '...' ); // URL of page containing iframe
        await mainTab.wait( 1000 );
        let frames = await mainTab.getFrames();
        frames = frames.filter( f => f.name === 'the_frame' );
        const frame = frames[0].id;
        await mainTab.click( '#the_button', frame );
} );

Instead I receive this error:

(node:18709) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: No node with given id found
(node:18709) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

What is the the correct value to pass as frameId? Is this a bug or am I just misunderstanding usage?

@mmarsella
Copy link

Hey Strabbit,

If you log what the output of let frames = await mainTab.getFrames();, what do you get?

I've been using this library a lot lately - so I may be able to help.

M

@strabbit
Copy link
Author

strabbit commented Aug 4, 2017

[ { id: '21949.1',
    loaderId: '21949.2',
    url: 'http://strabbit.com/frame-example/frameset.html',
    securityOrigin: 'http://strabbit.com',
    mimeType: 'text/html' },
  { id: '21949.2',
    parentId: '21949.1',
    loaderId: '21949.3',
    name: 'the_frame',
    url: 'http://strabbit.com/frame-example/frame.html',
    securityOrigin: 'http://strabbit.com',
    mimeType: 'text/html' } ]

Meaning I'm passing 21949.2 as frame to mainTab.click.

@strabbit strabbit changed the title FrameID selection broken? FrameID selection broken for framesets? Aug 5, 2017
@strabbit
Copy link
Author

strabbit commented Aug 5, 2017

I've edited the original post. It works for iframes but not for frames in a frameset.

@LucianoGanga
Copy link
Owner

Hi @strabbit !

I've never used framesets. I think that the problem that you're having is related to how simple-headless-chrome tries to find the correct scope when you pass a frameId:

https://github.com/LucianoGanga/simple-headless-chrome/blob/master/lib/actions.js#L306

Do you know of a website with framesets so we can make a test case for the scenario that you need? We can modify simple-headless-chrome to support those cases.

Thanks!
Lucho

@strabbit
Copy link
Author

strabbit commented Aug 6, 2017

Thanks @LucianoGanga

http://strabbit.com/frame-example/frameset.html is a very simple frameset example. It's the one I used to verify the issue.

@LucianoGanga
Copy link
Owner

Thanks!
I'll look into it later. I'll let you know if I can fix and upload an example with that (I'll try to make some extra time to prepare a test case too, just to ensure future compatibility).

Cheers!
Lucho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants