4 ms·
If using Selenium's Python bindings, you can take a screenshot from Selenium and convert it to OpenCV format like this: cv2.imdecode( numpy.asarray
by drothlis 11y ago
If using Selenium's Python bindings, you can take a screenshot from
Selenium and convert it to OpenCV format like this:
cv2.imdecode(
numpy.asarray(
bytearray(base64.decodestring(driver.get_screenshot_as_base64())),
dtype=numpy.uint8),
cv2.CV_LOAD_IMAGE_UNCHANGED)
(where `driver` is your WebDriver object, e.g. `WebDriver.Chrome()`).
Then to match that frame against a previously-captured "template" image,
you can use stb-tester's[1] "match" function[2] which allows you to
specify things like the region to ignore and tweak the matching
sensitivity.
[1] http://stb-tester.com http://stb-tester.com
[2] http://stb-tester.com/stb-tester-one/rev2015.1/python-api#stbt.match http://stb-tester.com/stb-tester-one/rev2015.1/python-api#st...