Scroll event not triggering correctly?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- html, java, javascript
- Lĩnh vực
- testing
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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...
- Ngôn ngữ chính
- JavaScript
- Star
- 952
- Fork
- 183
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của HtmlUnit/htmlunit
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của HtmlUnit/htmlunit
Issue tương tự
-
44-x-y bug :beetle:
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
electron/electron#55528 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
react/react-native#59699 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mastra-ai/mastra#29053 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[feature] Extra citiesĐang mởenhancement triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fjaeckel/seriesoftubes#230 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày