# install chromium and selenium
!apt update
!apt install chromium-chromedriver
!pip install selenium
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
# Initialize WebDriver and get the HTML file
wd = webdriver.Chrome(options=options)
wd.set_window_size(1366, 728)
wd.get('https://kargaranamir.github.io')
# Wait for some time to ensure page is fully loaded (adjust as needed)
wd.implicitly_wait(10)
# Take screenshot of the visible area and save it
screenshot_path = 'screenshot.png'
wd.save_screenshot(screenshot_path)