From 313d31cc3e4948ac1b43bf86e910cc1138547fca Mon Sep 17 00:00:00 2001 From: Navin Chandra <98466550+navin772@users.noreply.github.com> Date: Wed, 27 Nov 2024 01:47:36 +0530 Subject: [PATCH] [py]: add docs for `get_log` for chrome and edge (#2074)[deploy site] add docs for `get_log` in python for chrome and edge Co-authored-by: Sri Harsha <12621691+harsha509@users.noreply.github.com> --- examples/python/tests/browsers/test_chrome.py | 12 ++++++++++++ examples/python/tests/browsers/test_edge.py | 12 ++++++++++++ .../documentation/webdriver/browsers/chrome.en.md | 6 +++--- .../documentation/webdriver/browsers/chrome.ja.md | 6 +++--- .../documentation/webdriver/browsers/chrome.pt-br.md | 6 +++--- .../documentation/webdriver/browsers/chrome.zh-cn.md | 6 +++--- .../documentation/webdriver/browsers/edge.en.md | 6 +++--- .../documentation/webdriver/browsers/edge.ja.md | 6 +++--- .../documentation/webdriver/browsers/edge.pt-br.md | 6 +++--- .../documentation/webdriver/browsers/edge.zh-cn.md | 6 +++--- 10 files changed, 48 insertions(+), 24 deletions(-) diff --git a/examples/python/tests/browsers/test_chrome.py b/examples/python/tests/browsers/test_chrome.py index 55667f51465..d34fe294654 100644 --- a/examples/python/tests/browsers/test_chrome.py +++ b/examples/python/tests/browsers/test_chrome.py @@ -176,3 +176,15 @@ def test_cast_features(): pytest.skip("No available Cast sinks to test with.") finally: driver.quit() + + +def test_get_browser_logs(): + driver = webdriver.Chrome() + + driver.get("https://www.selenium.dev/") + + logs = driver.get_log("browser") + + # Assert that at least one log contains the expected message + assert any("Uncaught TypeError" in log['message'] for log in logs), "No matching log message found." + driver.quit() diff --git a/examples/python/tests/browsers/test_edge.py b/examples/python/tests/browsers/test_edge.py index 363b15ea49f..b13fd9d7cb5 100644 --- a/examples/python/tests/browsers/test_edge.py +++ b/examples/python/tests/browsers/test_edge.py @@ -176,3 +176,15 @@ def test_cast_features(): pytest.skip("No available Cast sinks to test with.") finally: driver.quit() + + +def test_get_browser_logs(): + driver = webdriver.Edge() + + driver.get("https://www.selenium.dev/") + + logs = driver.get_log("browser") + + # Assert that at least one log contains the expected message + assert any("Uncaught TypeError" in log['message'] for log in logs), "No matching log message found." + driver.quit() diff --git a/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md b/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md index 6e4f28c6a71..73e15db6b80 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md @@ -421,9 +421,9 @@ You can simulate various network conditions. {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L186" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md b/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md index 241fbb3162b..cbeac4e63b9 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md @@ -415,9 +415,9 @@ Chrome Castデバイスを操作することができ、タブの共有も含ま {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L186" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md b/website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md index e273d7f813a..45a11b1d349 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md @@ -424,9 +424,9 @@ please refer to the {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L186" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md b/website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md index cf2dde60719..b08634037c0 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md @@ -424,9 +424,9 @@ Chromedriver 和 Chrome 浏览器版本应该匹配, 如果它们不匹配, 驱 {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L186" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/edge.en.md b/website_and_docs/content/documentation/webdriver/browsers/edge.en.md index 2bcae96e363..f31f9e17e66 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.en.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.en.md @@ -422,9 +422,9 @@ You can simulate various network conditions. {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L186" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md b/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md index cf8098c5581..e86c9aaeaa9 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md @@ -408,9 +408,9 @@ Edge を使用して Chrome Cast デバイスを操作し、タブを共有す {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L186" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md b/website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md index 23e7599d04d..5afe7d1e32c 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md @@ -424,9 +424,9 @@ You can simulate various network conditions. {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L186" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md b/website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md index cce5a9e4e36..50e7b05b855 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md @@ -424,9 +424,9 @@ You can simulate various network conditions. {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L186" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}}