I'm trying to open Chrome in non-headless mode with an extension enabled to take a full page screenshot. When I remove headless mode, the extension works but the taken fullscreen is not for the full page. Without headless mode, the extension cannot be loaded.
I came across this answer which mentions that it is not possible without headless option. However, extensions cannot be enabled in headless option.
Take screenshot of full page with Selenium Python with chromedriver
here is my current code. Is there away to do this?
print("Taking screenshot for {}".format(link))
options = webdriver.ChromeOptions()
options.add_extension('./chromedrivers/AdblockPlus.zip')
options.add_argument("--disable-notifications")
#options.headless = True
driver = webdriver.Chrome("{}/chromedrivers/{}".format("macDriver"),options=options)
driver.implicitly_wait(1)
driver.get(link)
S = lambda X: driver.execute_script('return document.body.parentNode.scroll'+X)
driver.set_window_size(S('Width'), S('Height'))
driver.find_element_by_tag_name('body').screenshot(f'./screenshots/{name}.png')