Im = im. Right = (location + size) * 3īottom = (location + size) * 3 Left = location * 3 # must mutliply all these numbers by your zoom First class features Explore all features Full height screenshots Need mobile screenshots of a responsive website Need full page screenshots No problem Use the website screenshot maker of Stillio. Im = Image.open(BytesIO(png)) # uses PIL library to open image in memory Enter the web address of the pages you want to track and set the desired capture frequency. Png = chrome.get_screenshot_as_png() # saves screenshot of entire page # MUST BE HEADLESS AND HAVE VERY LARGE WINDOW SIZEĬhrome_options.add_argument("-headless")Ĭhrome_options.add_argument("-window-size=6000x5000")ĭef get_screenshot(url_path, object_type, object_id):Ĭhrome = webdriver.Chrome(chrome_options=chrome_options,Ĭhrome.execute_script(" = '300%'") # ZOOMĮlement = chrome.find_element_by_id(object_id) # find part of the page you want image of Here's the solution I found: from selenium import webdriverįrom import Options I had the exact same problem, using Python 3.7 and the chrome webdriver, and the answers above helped a lot but none worked perfectly for me. nd_keys_to_element(body,Keys.CONTROL,"+").perform() You can also use selenium.windowMaxmize().Īnd if you want to magnify the screen to see some specific texts as you said, you can try this in Mozilla: from import Keysįrom _chains import ActionChainsīody = br.find_element_by_tag_name('body') Region.save('screen_lores.jpg', 'JPEG', optimize=True, quality=95) Im = Image.open(StringIO.StringIO(screen)) # Crop it back to the window size (it may be taller) import StringIOĭriver = webdriver.PhantomJS(executable_path="node_modules/phantomjs/bin/phantomjs")ĭt_window_size(1366, 728) # optionalĭriver.save_screenshot('screen_hires.png') As you can see, you can adjust both Window size and quality of the screenshot. Here is an example of doing this from Github of one of the developers. If it is about changing window size, you can set it by t_window_size(480, 320)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |