Hi Vickyraghuwanshi,
Thank you for your suggestion. It does work work some arbitrary website, but not for the streamlit app.
With the given code I get following error:
from selenium.webdriver.chrome.service import Service
chrome_options = Options()
chrome_options.add_argument("--headless") # Set any desired options
driver = webdriver.Chrome(options=chrome_options, service=Service(ChromeDriverManager().install()))
driver.implicitly_wait(10)
# Navigate to the desired web page
url = ' http://localhost:8501/' # Replace with your desired URL
driver.get(url)
# Small screenshot
driver.get_screenshot_as_file('report.png')
# Full screenshot
S = lambda x: driver.execute_script('return document.body.parentNode.scroll' + x)
driver.set_window_size(S('Width'), S('Height'))
driver.find_element(By.XPATH, '/html/body').screenshot('report_full.png')
selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {“code”:-32000,“message”:“Cannot take screenshot with 0 height.”}. I have also tried to use other elements, but I only have managed to get a small screenshot.
Any other suggestion are appreciated!
UPDATE:
Following solution was found. It does produce some bugs with sidebar animation and loading animation, but nothing critical.
allow_scroll = """
<style>
.stApp{ position: relative !important;}
.appview-container{ position: relative !important;}
</style>
"""
st.markdown(allow_scroll, unsafe_allow_html=True)