I have a webpage that I need to take the screen shot first and then use OCR to parse out the texts inside. The performance of OCR could be dramatically improved if I zoom in(Mac: command + '='). So I am wondering how could I zoom in/out using selenium in Python.
There is a similar post but they only have the implementations in Java and C#, but the goal is the same as mine.
Zoom in/out in selenium is just one of my thoughts. To improve the performance. I know there might be several ways to implement. Below are just my thoughts and I never successfully implement them. If you could prove them work and change the font size, I would also accept as answer.
Maybe change the settings of the browser and then save as a Chrome profile, so next time, I could just call the profile and the 'ZOOM' settings should be preserved throughout the whole process without touching anything. However, seems like python selenium package doesn't support load chrome profile, however, it could load firefox profile. Link
Maybe take the screen shot as a vector image, so use PIL etc. to amplify the font size separately.
...
Thanks a lot for the post and the a sample code to get you started!
#!/usr/bin/python
from selenium import webdriver
def main():
browser = webdriver.Chrome() # Sorry, I have to use Chrome, [chromedriver][3] is required
browser.set_window_size(1000, 1000)
browser.get("https://stackoverflow.com/users/1953475/b-mr-w")
# Fill in Your Magic Here to Make the Font Size Big!
browser.get_screenshot_as_file('/tmp/screenshot.png')
if __name__ == '__main__':
main()