How can I use JavaScript to scroll the page to make an element clickable?

Responsive Ad Header

Question

Grade: Education Subject: Support
How can I use JavaScript to scroll the page to make an element clickable?
Asked by:
73 Viewed 73 Answers

Answer (73)

Best Answer
(245)
You can use JavaScript to scroll the element into view: `JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].scrollIntoView();", element);` This will scroll the page so that the element is visible in the viewport.