diff --git a/runner/scripts/adapters/ab_scenario_adapter.js b/runner/scripts/adapters/ab_scenario_adapter.js index 01641ee..bae2bff 100644 --- a/runner/scripts/adapters/ab_scenario_adapter.js +++ b/runner/scripts/adapters/ab_scenario_adapter.js @@ -376,7 +376,12 @@ async function main() { } case "click": { const times = Number(step.times || 1); - for (let i = 0; i < times; i += 1) await abOrThrow(["click", sel]); + for (let i = 0; i < times; i += 1) { + // The tool's click sends coordinates even when the center is outside + // the viewport. Use its native visibility operation before clicking. + await abOrThrow(["scrollintoview", sel]); + await abOrThrow(["click", sel]); + } return `clicked x${times}`; } case "fill": @@ -394,6 +399,7 @@ async function main() { return `pressed ${step.key}`; } case "check": + await abOrThrow(["scrollintoview", sel]); await abOrThrow(["check", sel]); return "checked"; case "select_option": { diff --git a/runner/scripts/adapters/ferrum_adapter.rb b/runner/scripts/adapters/ferrum_adapter.rb index 448099e..b2c9280 100644 --- a/runner/scripts/adapters/ferrum_adapter.rb +++ b/runner/scripts/adapters/ferrum_adapter.rb @@ -233,7 +233,7 @@ def run_op(step) times = (step["times"] || 1).to_i times.times do node = find_node(timeout, sel) - call_op(timeout) { node.click } + call_op(timeout) { node.scroll_into_view.click } end "clicked x#{times}" when "fill" @@ -258,7 +258,7 @@ def run_op(step) already = eval_value(timeout, sel_expr(sel, "return !!el.checked;")) unless already == true node = find_node(timeout, sel) - call_op(timeout) { node.click } + call_op(timeout) { node.scroll_into_view.click } end "checked" when "select_option"