Compare commits

...

3 Commits

Author SHA1 Message Date
Dustin ab990dba14 Add take_screenshot method
The `WebDriver:TakeScreenshot` command apparently also accepts an
`element` argument, but I am not exactly sure what value it expects.
2022-04-30 18:16:56 -05:00
Dustin 471392106f Refactor as package, add py.typed file
In order to indicate to external modules that this module contains type
hints, it must include a `py.typed` file.  Single-file module
distributions cannot include other files, so in order to distribute the
`py.typed` file, this module has to be distributed as a package.
2022-04-30 14:22:22 -05:00
Dustin 1e44560bca Begin v0.0.2 2022-04-30 14:22:22 -05:00
3 changed files with 21 additions and 1 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "aiomarionette" name = "aiomarionette"
version = "0.0.1.post1" version = "0.0.2"
description = "Firefox Marionette client for asyncio" description = "Firefox Marionette client for asyncio"
readme = "README.md" readme = "README.md"
authors = ["Dustin C. Hatch <dustin@hatch.name>"] authors = ["Dustin C. Hatch <dustin@hatch.name>"]

View File

@ -174,6 +174,26 @@ class WebDriverBase(_BaseRPC, metaclass=abc.ABCMeta):
'WebDriver:SwitchToWindow', handle=handle, focus=focus 'WebDriver:SwitchToWindow', handle=handle, focus=focus
) )
async def take_screenshot(
self,
*,
hash: bool = False, # pylint: disable=redefined-builtin
full: bool = True,
scroll: bool = True,
) -> str:
'''Take a screenshot of the current frame
:returns: Lossless PNG image encoded as a base-64 Unicode string
'''
res: Dict[str, str] = await self._send_message(
'WebDriver:TakeScreenshot',
full=full,
hash=hash,
scroll=scroll,
)
return res['value']
class Marionette(WebDriverBase): class Marionette(WebDriverBase):
'''Firefox Marionette session '''Firefox Marionette session

View File