Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Scroll event not triggering correctly?

オープン
#657 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
html, java, javascript
領域
testing

調査の方向性

Start by reproducing the supplied JUnit test with both ChromeDriver and HtmlUnitDriver; the issue does not name repository files or existing tests to use. Investigate how HtmlUnit handles scrollIntoView and IntersectionObserver, then add a regression test for the behavior. Done means the observer callback increments the count as expected in HtmlUnit, while the Chrome comparison still passes.

索引モデルが issue の本文から書いたものです。

説明

I've ran into a case where triggering javascript scrollintoView has no effect, not triggering an event that is supposed to dynamically load the next page of data.

Here is a basic test case:

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;

public class ScrollTest {

    public static final String PAGE;

    static {
        try {
            PAGE = Files.readString(Path.of(ScrollTest.class.getClassLoader().getResource("testPage1.html").toURI()));
        } catch (IOException | URISyntaxException e) {
            throw new RuntimeException(e);
        }
    }

    private static final HtmlUnitDriver huDriver = new HtmlUnitDriver(true);
    private static final WebDriver chromeDriver = new ChromeDriver();

    @AfterAll
    static void closeAll(){
        huDriver.close();
        chromeDriver.close();
    }

    @Test
    void givenPageWithTable_whenScrollTo_TriggerEvent(){
        runTest(chromeDriver);
        runTest(huDriver);
    }

    private static void runTest(WebDriver driver) {
        driver.get(PAGE);
        ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView()", driver.findElement(By.id("last")));
        Assertions.assertEquals(1L,
                ((JavascriptExecutor) driver).executeScript("return count"));
    }

}

and here is the html file I used for testing, feel free to add more table rows if needed

data:text/html,
<table>
    <tr>row</tr>
    <br>
    <tr id="last"></tr>
</table>
<script>
    var count = 0;
    const observer = new IntersectionObserver((entries) => { 
    entries.forEach((entry) => {
        console.log("triggered");
        count++;
    })
}); 

observer.observe(document.getElementById("last"));
</script>

The results are incosistent:

org.opentest4j.AssertionFailedError: 
Expected :1
Actual   :0
<Click to see difference>

at ScrollTest.runTest(ScrollTest.java:45)
at ScrollTest.givenPageWithTable_whenScrollTo_TriggerEvent(ScrollTest.java:39)

...removed rest of generic stack trace...	
主要言語
JavaScript
スター
952
フォーク
183
平均マージ
2日 1時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

HtmlUnit/htmlunit のほかの issue

HtmlUnit/htmlunit の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。