Код: Выделить всё
test('test_temp', async t => {
await t.wait(1000)
await t.click('.parent',{
offsetX: 300,
offsetY: 300
})
await t.wait(5000)
await t.eval(() => {
window.HTMLElement.prototype.scrollIntoView = function () {
// 禁用所有元素的滚动
};
});
await t.click('.parent',{
offsetX: 20,
offsetY: 20
})
})< /code>
testChild
.parent {
position: relative;
width: 200px;
height: 200px;
overflow: auto;
border: 2px solid black;
z-index: 3;
/* background: blueviolet; */
}
.child {
content: "";
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
width: 1000px;
height: 1000px;
background: linear-gradient(#0602f5, #01ff40, #f50222,#f1f502);
}
const parent = document.querySelector('.parent');
parent.addEventListener('click', function (e) {
console.log(e, e.target, e.currentTarget);
});
const child = document.querySelector('.child');
child.addEventListener('click', function (e) {
console.log(e, e.target, e.currentTarget);
e.stopPropagation();
})
Подробнее здесь: https://stackoverflow.com/questions/797 ... n-child-el