I am using selenium / phantomjs to create html png files in python. Is there a way to generate png from an html or filehandle string (instead of a website)? I searched for selenium documents and searched, but could not find an answer. I have:
htmlString = '<html><body><div style="background-color:red;height:500px;width:500px;">This is a png</div></body></html>' myFile = 'tmp.html' f = open(myFile,'w') f.write(htmlString) from selenium import webdriver driver = webdriver.PhantomJS() driver.set_window_size(1024, 768)
user776942
source share