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

click() isn't working: scrolling issue? #4110

Closed
hlr1983 opened this issue Mar 4, 2019 · 7 comments
Closed

click() isn't working: scrolling issue? #4110

hlr1983 opened this issue Mar 4, 2019 · 7 comments
Labels
bug chromium Issues with Puppeteer-Chromium unconfirmed

Comments

@hlr1983
Copy link

hlr1983 commented Mar 4, 2019

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.12.2
  • Platform / OS version:
    uname -a
    Linux henrique-Latitude-5480 4.15.0-45-generic #⁠48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 18.04.2 LTS
    Release: 18.04
    Codename: bionic
  • URLs (if applicable):
  • Node.js version: v10.15.1

What steps will reproduce the problem?

I have the following piece of code, in a simplified way:

await Promise.all([
    _ifrArvoreFrameSEI.waitForNavigation(), //_ifrArvoreFrameSEI is class: Frame
    _ifrVisualizacaoSEI.waitForNavigation(), // _ifrVisualizacaoSEI is class: Frame
    _ifrArvoreFrameSEI.click('a#anchor18335653')
]);

What is the expected result?
Click on element 'a#anchor18335653' and resolves the waitForNavigation() promises.

What happens instead?
sometimes waitForNavigation timeouts

So I ran Chrome with graphical interface, and verified that _ifrArvoreFrameSEI.click('a#anchor18335653') doesn't seem to be scrolling. When I have the following screen, it works:

image

But on this one, it doesn't work:

image

I think the problem might be in the scroll bar marked with Red, as puppeteer doesn't seem to be scrolling it. Sorry for the black stripes, I had to add them because the screen potentially shows private data.

'a#anchor18335653' is shown below.
image

When I manually scrolled the bar, in the 5 seconds given by Atomics.wait, it works:

var sab = await new SharedArrayBuffer(1024);
var int32 = await new Int32Array(sab);
await console.log("SLEEPING");
await Atomics.wait(int32, 0, 0,5000);

await Promise.all([
    _ifrArvoreFrameSEI.waitForNavigation(),
    _ifrVisualizacaoSEI.waitForNavigation(),
    _ifrArvoreFrameSEI.click('a#anchor18335653')
]);

It woks if Chrome is launched with defaultViewport: {width: 2000, height:2000}

I've also noticed that the code bellow works fine:

await Promise.all([
    _ifrArvoreFrameSEI.waitForNavigation(), //_ifrArvoreFrameSEI is class: Frame
    _ifrVisualizacaoSEI.waitForNavigation(), // _ifrVisualizacaoSEI is class: Frame
    _ifrArvoreFrameSEI.evaluate( () => document.querySelector('a#anchor18335653').click())
]);

Thanks.

@aslushnikov
Copy link
Contributor

@hlr1983 this looks like a problem with clicking something inside an iframe. I tried clicking a button inside an iframe that was scrolled away, but it worked fine.

Any chance you can build a small repro website that reproduces it so that we can see what's going on and fix it?

@hlr1983
Copy link
Author

hlr1983 commented Mar 5, 2019

I saved the files locally and I think it is reproducible with local files, as shown in this video. On the first run it clicks and the browser tries to open the link, on the second I manually scroll down and the browser doesn't.

How could I send the files to you, @aslushnikov?

Thank you very much.

PS:
The code I ran is

(async () => {

    try {
        const puppeteer = await require('puppeteer');

        const browser = await puppeteer.launch({
                        headless:false, 
                        //defaultViewport: {width: 300, height:300}
                    });
        const incognito = await browser.createIncognitoBrowserContext();
        const page = await incognito.newPage();
        
        await page.goto('file://' + process.cwd() + '/test/SEI - Processo.html',{waitUntil: 'load'});
        
        var sab = await new SharedArrayBuffer(1024);
        var int32 = await new Int32Array(sab);
        await console.log("PLEASE MANUALLY SCROLL FOR ERROR");
        await Atomics.wait(int32, 0, 0,5000);
        
        
        const _ifrArvoreFrameSEI = await page.frames().filter( el => el.name() == 'ifrArvore')[0];
        
        await _ifrArvoreFrameSEI.click('a#anchor12502367');


    } catch (e) {
        await console.log(e);
        await process.exit(1);
    };
})()

@aslushnikov
Copy link
Contributor

@hlr1983 feel free to send them over to aslushnikov[at]gmail.com or lushnikov[at]google.com

@hlr1983
Copy link
Author

hlr1983 commented Mar 6, 2019

Ok. Sent to lushnikov[at]google.com

@aslushnikov
Copy link
Contributor

@hlr1983 thank you very much! I was able to repro and add a failing test; we'll fix it shortly.

@aslushnikov aslushnikov added bug chromium Issues with Puppeteer-Chromium firefox labels Mar 7, 2019
kiku-jw pushed a commit to kiku-jw/puppeteer that referenced this issue Apr 6, 2019
@stale
Copy link

stale bot commented Jun 27, 2022

We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.

@stale stale bot added the unconfirmed label Jun 27, 2022
@stale
Copy link

stale bot commented Jul 27, 2022

We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!

@stale stale bot closed this as completed Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug chromium Issues with Puppeteer-Chromium unconfirmed
Projects
None yet
Development

No branches or pull requests

2 participants