See below where I try to screenshot Facebook. The top bar which is normally at the top of the browser, is appearing in the middle of the screenshot.
How can I hide it, or adjust the browser so that the top bar stays up and out of the way?
I use Selenium to screenshot then I sent it to PIL to get it cropped.
Note that when this appears, I may be scrolled down quite a ways.
You can manipulate the html code like deleting the class attribute of the navigation bar by this driver.execute_script("document.getElementById('blueBarNAXAnchor').setAttribute('class', '')")
then it stay in the begining of the page without style. Then you can take screenshot without it. See the below, check face_1.png:
>>> driver.save_screenshot("face.png")
True
>>> driver.execute_script("document.getElementById('blueBarNAXAnchor').setAttribute('class', '')")
>>> driver.save_screenshot("face_1.png")
True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With