Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Python Example to PrintPage Documentation #2009

Merged
merged 2 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions examples/python/tests/interactions/test_prints_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest
from selenium import webdriver
from selenium.webdriver.common.print_page_options import PrintOptions

pytest.fixture()
def driver():
driver = webdriver.Chrome()
yield driver
driver.quit()

def test_prints_page(driver):
driver.get("https://www.selenium.dev/")
print_options = PrintOptions()
pdf = driver.print_page(print_options)
assert len(pdf) > 0
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ Note: `BrowsingContext()` is part of Selenium's BiDi implementation. To enable B
{{< tab header="Ruby" >}}
{{< badge-implementation >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< badge-code >}}
{{% tab header="Python" %}}
**print_page()**
{{< gh-codeblock path="examples/python/tests/interactions/test_prints_page.py#L11-L15" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-implementation >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ Note: `BrowsingContext()` is part of Selenium's BiDi implementation. To enable B
{{< tab header="Ruby" >}}
{{< badge-implementation >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< badge-code >}}
{{% tab header="Python" %}}
**print_page()**
{{< gh-codeblock path="examples/python/tests/interactions/test_prints_page.py#L11-L15" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-implementation >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ Note: `BrowsingContext()` is part of Selenium's BiDi implementation. To enable B
{{< tab header="Ruby" >}}
{{< badge-implementation >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< badge-code >}}
{{% tab header="Python" %}}
**print_page()**
{{< gh-codeblock path="examples/python/tests/interactions/test_prints_page.py#L11-L15" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-implementation >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ Note: `BrowsingContext()` is part of Selenium's BiDi implementation. To enable B
{{< tab header="Ruby" >}}
{{< badge-implementation >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< badge-code >}}
{{% tab header="Python" %}}
**print_page()**
{{< gh-codeblock path="examples/python/tests/interactions/test_prints_page.py#L11-L15" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-implementation >}}
Expand Down
Loading