Notifications
Clear all
Topic starter
16/01/2023 8:54 am
I am dealing with multiple sticky elements to take a non-repetitive full-page screenshot. Updating each element one by one is very time consuming. Is there any way to do this automatically?
I am using java and selenium to run TC's .
16/01/2023 8:58 am
Run the following code using JavaScript executor:
var elements = document.querySelectorAll("*"); // Iterate through the elements and check for "position: sticky" for (var i = 0; i < elements.length; i++) { var element = elements[i]; var style = window.getComputedStyle(element); var position = style.getPropertyValue("position"); if (position === "sticky") { // If the element has "position: sticky", set "position" to "relative" element.style.position = "absolute"; // element.style.position = "relative"; } if (position === "fixed") { // If the element has "position: fixed", set "position" to "relative" element.style.position = "absolute"; // element.style.position = "relative"; } }
You can choose on how you want those elements to appear to using relative/absolute positions.
This post was modified 2 years ago by admin