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

fix(input): clicking an element should take into account frame position #971

Merged
merged 2 commits into from Oct 9, 2017

Conversation

JoelEinbinder
Copy link
Collaborator

fixes #684

@aslushnikov
Copy link
Contributor

The .getBoxModel returns something different for me. It probably should be fixed/enhanced first.

@JoelEinbinder
Copy link
Collaborator Author

It returns different numbers when scale is involved, which we currently don't handle in Puppeteer.

@veb
Copy link

veb commented Oct 6, 2017

Sorry if I'm not supposed to comment here, but I pulled this fix to try this snippet (posted by @paulirish in #618) and it does click if I comment out the outerHTML stuff.

const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({headless: false, slowMo: 250});
const page = await browser.newPage();
await page.goto('https://www.w3schools.com/TAgs/tryit.asp?filename=tryhtml_button_test');

const frames = await page.frames();
const tryItFrame = frames.find(f => f.name() === 'iframeResult');
const framedButton = await tryItFrame.$('button');

const outerHTML = await framedButton.evaluate(e => e.parentNode.outerHTML);
console.log('the outerhtml: ', outerHTML); // to verify we're talking about the right element.. (we are.)

framedButton.click();
})();

How is the evaluate stuff supposed to work in this context?

In another script, I tried to select an input to type in some data but I keep getting framedInput.type is not a function:

    const framedInput = await iframe.$('input#fm-login-id');
    framedInput.click(usernameSelector);
    framedInput.type(username);

Am I being an idiot?!

@JoelEinbinder
Copy link
Collaborator Author

JoelEinbinder commented Oct 6, 2017

@veb Paul's code was slightly out of date. elementHandle.evaluate was dropped. elementHandle.type is coming shortly in #801.

Edit: #943 does not add elementHandle.evaluate, I got confused.

@veb
Copy link

veb commented Oct 8, 2017

Thanks @JoelEinbinder I've tested those changes on #801 before it was merged and they work perfectly. I'm just waiting for this one to be merged and then selecting and typing into iframes will be worked just as intended 👍

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

Successfully merging this pull request may close these issues.

Clicking element inside iFrame does not give any response
3 participants