1

I'm trying to take multiple screenshots in java selenium webdriver . Taking a site such as mashable.com , there is a static header at the top. When I take my first screenshot there is no problem but as I scroll down to take a screenshot, there is a header on top which blocks some content.

Now, I don't wish to have the header on top. Manually, I played around with the css of the site in chrome. I found that by identifying the id and setting the position from position from fixed to null , I get the header removed. Is it possible to have a general way to identify these headers (only on the top) and modify their css property using javascript ?

1 Answer 1

1

You can try this:

$('*').filter(function() {
if ($(this).css('position') === 'fixed'){
   $(this).css('position', 'relative');
}

});
Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, it's a good solution but, how to ensure it's the header on top. There might be many fixed components on the page. But, I want only the top header to be removed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.