Skip to content

Conversation

@dotdoom
Copy link

@dotdoom dotdoom commented Mar 31, 2016

No description provided.

dotdoom added 7 commits March 31, 2016 12:38
The page is often useful even if some background
tracking script failed to load on time.
There could be some javascript that resizes components
while we're waiting for "delay" - need to let it do the job.
Setting elementSelector should allow to selectively
render page element (and its child elements), because
the whole page is not that useful at times.
@ghost
Copy link

ghost commented Jun 13, 2017

I successfully tested everything, but the element selector does not work:

Traceback (most recent call last):
  File "/home/sebastian/dev/python-webkit2png/webkit2png/scripts.py", line 206, in __main_qt
    renderer.render_to_file(res=options.url, file_object=options.output)
  File "/home/sebastian/dev/python-webkit2png/webkit2png/webkit2png.py", line 115, in render_to_file
    image = self.render(res)
  File "/home/sebastian/dev/python-webkit2png/webkit2png/webkit2png.py", line 100, in render
    image = helper.render(res)
  File "/home/sebastian/dev/python-webkit2png/webkit2png/webkit2png.py", line 263, in render
    self._page.mainFrame().documentElement())
TypeError: 'str' object is not callable

The rest works fine!

@dotdoom
Copy link
Author

dotdoom commented Aug 1, 2017

The elementSelector supplied must be a lambda of (document) -> (element, size). I guess you supplied a jQuery selector, which could also be interesting to implement.

@ghost
Copy link

ghost commented Aug 2, 2017

@dotdoom could you please add documentation along with an example? that would be helpful I think

@dotdoom
Copy link
Author

dotdoom commented Aug 2, 2017

@wagner-certat that would certainly be on my radar but I won't have cycles to get to it soon. In case you're interested here's one real life example:
https://github.com/dotdoom/comicsbot/blob/b52502a861d673760050b6ea36bdf7cc3ad0f82c/render.py#L119

For that project I had to switch from QtWebKit to QWebEngine (Chromium) eventually, because the latter has much better support for the latest CSS and HTML features: https://github.com/dotdoom/comicsbot/blob/master/web2png.py

@dotdoom
Copy link
Author

dotdoom commented Apr 13, 2021

I've switched to puppeteer meanwhile, closing this PR since I won't be able to follow up soon and it doesn't look to pick anyone else's interest.

@dotdoom dotdoom closed this Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant