Selenium Webdriver, screenshot as numpy array (Python)
1 answer
I'm sure there is a more efficient way to do this, but this is what worked for me:
from selenium import webdriver
from PIL import Image
import StringIO
import numpy as np
browser = webdriver.Firefox()
browser.get('https://www.google.ca/?gws_rd=ssl')
data = browser.get_screenshot_as_png()
img = Image.open(StringIO.StringIO(data))
numpy_array = np.asarray(img)
+5
source to share