From f70edb684f4763321dcdf12ca8a3e80833045783 Mon Sep 17 00:00:00 2001 From: Swastik Baranwal Date: Fri, 6 Dec 2024 00:37:15 +0530 Subject: [PATCH] [py] move information code to files (#2093)[deploy site] * [py] move information code to files * fix close tabs --------- Co-authored-by: Sri Harsha --- .../python/tests/elements/test_information.py | 45 ++++++++ .../webdriver/elements/information.en.md | 68 +++-------- .../webdriver/elements/information.ja.md | 78 ++++--------- .../webdriver/elements/information.pt-br.md | 107 +++++------------- .../webdriver/elements/information.zh-cn.md | 87 +++----------- 5 files changed, 125 insertions(+), 260 deletions(-) diff --git a/examples/python/tests/elements/test_information.py b/examples/python/tests/elements/test_information.py index 53b695b6fc83..a2d5d030af81 100644 --- a/examples/python/tests/elements/test_information.py +++ b/examples/python/tests/elements/test_information.py @@ -1,2 +1,47 @@ from selenium import webdriver +from selenium.webdriver.common.by import By +import pytest + + +def test_informarion(): + # Initialize WebDriver + driver = webdriver.Chrome() + driver.implicitly_wait(0.5) + + driver.get("https://www.selenium.dev/selenium/web/inputs.html") + + # isDisplayed + is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() + assert is_email_visible == True + + # isEnabled + is_enabled_button = driver.find_element(By.NAME, "button_input").is_enabled() + assert is_enabled_button == True + + # isSelected + is_selected_check = driver.find_element(By.NAME, "checkbox_input").is_selected() + assert is_selected_check == True + + # TagName + tag_name_inp = driver.find_element(By.NAME, "email_input").tag_name + assert tag_name_inp == "input" + + # GetRect + rect = driver.find_element(By.NAME, "range_input").rect + assert rect["x"] == 10 + + # CSS Value + css_value = driver.find_element(By.NAME, "color_input").value_of_css_property( + "font-size" + ) + assert css_value == "13.3333px" + + # GetText + text = driver.find_element(By.TAG_NAME, "h1").text + assert text == "Testing Inputs" + + # FetchAttributes + email_txt = driver.find_element(By.NAME, "email_input") + value_info = email_txt.get_attribute("value") + assert value_info == "admin@localhost" diff --git a/website_and_docs/content/documentation/webdriver/elements/information.en.md b/website_and_docs/content/documentation/webdriver/elements/information.en.md index 678091095968..cc456c78bdcd 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.en.md @@ -29,12 +29,8 @@ nature and relationship in the tree to return a value. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L20-L25" >}} {{< /tab >}} -{{< tab header="Python" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Get boolean value for is element display -is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L12-L15" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L18-L23" >}} @@ -68,12 +64,8 @@ Returns a boolean value, **True** if the connected element is {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L27-L30" >}} {{< /tab >}} - {{< tab header="Python" >}} - # Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - - # Returns true if element is enabled else returns false -value = driver.find_element(By.NAME, 'button_input').is_enabled() + {{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L19" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L25-L28" >}} @@ -106,12 +98,8 @@ Returns a boolean value, **True** if referenced element is {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L32-L35" >}} {{< /tab >}} - {{< tab header="Python" >}} - # Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - - # Returns true if element is checked else returns false -value = driver.find_element(By.NAME, "checkbox_input").is_selected() + {{< tab header="Python" text=true >}} + {{< gh-codeblock path="examples/python/tests/elements/test_information.py#L23" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L30-L33" >}} @@ -140,12 +128,8 @@ of the referenced Element which has the focus in the current browsing context. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L37-L40" >}} {{< /tab >}} - {{< tab header="Python" >}} - # Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - - # Returns TagName of the element -attr = driver.find_element(By.NAME, "email_input").tag_name + {{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L27" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L35-L38" >}} @@ -180,12 +164,8 @@ The fetched data body contain the following details: {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L42-L46" >}} {{< /tab >}} - {{< tab header="Python" >}} - # Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - - # Returns height, width, x and y coordinates referenced element -res = driver.find_element(By.NAME, "range_input").rect + {{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L31" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L40-L47" >}} @@ -217,13 +197,8 @@ of an element in the current browsing context. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L49-L51" >}} {{< /tab >}} - {{< tab header="Python" >}} - - # Navigate to Url -driver.get('https://www.selenium.dev/selenium/web/colorPage.html') - - # Retrieves the computed style property 'color' of linktext -cssValue = driver.find_element(By.ID, "namedColor").value_of_css_property('background-color') + {{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L35-L37" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L49-L51" >}} @@ -253,12 +228,8 @@ Retrieves the rendered text of the specified element. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L54-L57" >}} {{< /tab >}} - {{< tab header="Python" >}} - # Navigate to url -driver.get("https://www.selenium.dev/selenium/web/linked_image.html") - - # Retrieves the text of the element -text = driver.find_element(By.ID, "justanotherlink").text + {{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L41" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L53-L56" >}} @@ -290,15 +261,8 @@ with the DOM attribute or property of the element. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L60-L65" >}} {{< /tab >}} - {{< tab header="Python" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Identify the email text box -email_txt = driver.find_element(By.NAME, "email_input") - -# Fetch the value property associated with the textbox -value_info = email_txt.get_attribute("value") + {{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L44-L46" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L63" >}} diff --git a/website_and_docs/content/documentation/webdriver/elements/information.ja.md b/website_and_docs/content/documentation/webdriver/elements/information.ja.md index 100d73e3f370..70b5d3d18153 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.ja.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.ja.md @@ -29,14 +29,8 @@ nature and relationship in the tree to return a value. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L20-L25" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Get boolean value for is element display -is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L12-L15" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L18-L23" >}} @@ -69,12 +63,8 @@ is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L27-L30" >}} {{< /tab >}} -{{< tab header="Python" >}} -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns true if element is enabled else returns false -value = driver.find_element(By.NAME, 'button_input').is_enabled() +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L19" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L25-L28" >}} @@ -105,12 +95,8 @@ value = driver.find_element(By.NAME, 'button_input').is_enabled() {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L32-L35" >}} {{< /tab >}} -{{< tab header="Python" >}} -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns true if element is checked else returns false -value = driver.find_element(By.NAME, "checkbox_input").is_selected() +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L23" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L30-L33" >}} @@ -139,12 +125,8 @@ val attr = driver.findElement(By.name("checkbox_input")).isSelected() {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L37-L40" >}} {{< /tab >}} -{{< tab header="Python" >}} -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns TagName of the element -attr = driver.find_element(By.NAME, "email_input").tag_name +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L27" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L35-L38" >}} @@ -179,13 +161,9 @@ val attr = driver.findElement(By.name("email_input")).getTagName() {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L42-L46" >}} {{< /tab >}} -{{< tab header="Python" >}} -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns height, width, x and y coordinates referenced element -res = driver.find_element(By.NAME, "range_input").rect -{{< /tab >}} + {{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L31" >}} + {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L40-L47" >}} {{< /tab >}} @@ -215,14 +193,9 @@ println(res.getX()) {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L49-L51" >}} {{< /tab >}} -{{< tab header="Python" >}} -# Navigate to Url -driver.get('https://www.selenium.dev/selenium/web/colorPage.html') - -# Retrieves the computed style property 'color' of linktext -cssValue = driver.find_element(By.ID, "namedColor").value_of_css_property('background-color') - -{{< /tab >}} +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L35-L37" >}} +{{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L49-L51" >}} {{< /tab >}} @@ -249,12 +222,8 @@ val cssValue = driver.findElement(By.id("namedColor")).getCssValue("background-c {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L54-L57" >}} {{< /tab >}} -{{< tab header="Python" >}} -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/linked_image.html") - -# Retrieves the text of the element -text = driver.find_element(By.ID, "justanotherlink").text +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L41" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L53-L56" >}} @@ -284,18 +253,9 @@ with the DOM attribute or property of the element. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L60-L65" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Identify the email text box -email_txt = driver.find_element(By.NAME, "email_input") - -# Fetch the value property associated with the textbox -value_info = email_txt.get_attribute("value") - -{{< /tab >}} + {{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L44-L46" >}} + {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L63" >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/elements/information.pt-br.md b/website_and_docs/content/documentation/webdriver/elements/information.pt-br.md index 0ce2be71c568..4b985b45398c 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.pt-br.md @@ -30,14 +30,8 @@ nature and relationship in the tree to return a value. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L20-L25" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Get boolean value for is element display -is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L12-L15" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L18-L23" >}} @@ -70,14 +64,8 @@ Returns a boolean value, **True** if the connected element is {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L27-L30" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns true if element is enabled else returns false -value = driver.find_element(By.NAME, 'button_input').is_enabled() - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L19" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L25-L28" >}} @@ -89,13 +77,11 @@ value = driver.find_element(By.NAME, 'button_input').is_enabled() {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L23-L24">}} {{< /tab >}} {{< tab header="Kotlin" >}} +//navigates to url +driver.get("https://www.selenium.dev/selenium/web/inputs.html") - //navigates to url - driver.get("https://www.selenium.dev/selenium/web/inputs.html") - - //returns true if element is enabled else returns false - val attr = driver.findElement(By.name("button_input")).isEnabled() - +//returns true if element is enabled else returns false +val attr = driver.findElement(By.name("button_input")).isEnabled() {{< /tab >}} {{< /tabpane >}} @@ -115,14 +101,8 @@ Retorna um valor booleano, **true** se o elemento referenciado for {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L32-L35" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns true if element is checked else returns false -value = driver.find_element(By.NAME, "checkbox_input").is_selected() - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L23" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L30-L33" >}} @@ -153,14 +133,8 @@ do elemento referenciado que tem o foco no contexto de navegação atual. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L37-L40" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns TagName of the element -attr = driver.find_element(By.NAME, "email_input").tag_name - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L27" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L35-L38" >}} @@ -171,13 +145,13 @@ attr = driver.find_element(By.NAME, "email_input").tag_name {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L37-L38">}} {{< /tab >}} - {{< tab header="Kotlin" >}} - //navigates to url - driver.get("https://www.selenium.dev/selenium/web/inputs.html") +{{< tab header="Kotlin" >}} +//navigates to url +driver.get("https://www.selenium.dev/selenium/web/inputs.html") - //returns TagName of the element - val attr = driver.findElement(By.name("email_input")).getTagName() - {{< /tab >}} +//returns TagName of the element +val attr = driver.findElement(By.name("email_input")).getTagName() +{{< /tab >}} {{< /tabpane >}} ## Coletar retângulo do elemento @@ -196,14 +170,8 @@ O corpo de dados buscado contém os seguintes detalhes: {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L42-L46" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns height, width, x and y coordinates referenced element -res = driver.find_element(By.NAME, "range_input").rect - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L31" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L40-L47" >}} @@ -235,15 +203,9 @@ de um elemento no contexto de navegação atual. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L49-L51" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to Url -driver.get('https://www.selenium.dev/selenium/web/colorPage.html') - -# Retrieves the computed style property 'color' of linktext -cssValue = driver.find_element(By.ID, "namedColor").value_of_css_property('background-color') - -{{< /tab >}} +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L35-L37" >}} +{{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L49-L51" >}} {{< /tab >}} @@ -273,14 +235,8 @@ Recupera o texto renderizado do elemento especificado. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L54-L57" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/linked_image.html") - -# Retrieves the text of the element -text = driver.find_element(By.ID, "justanotherlink").text - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L41" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L53-L56" >}} @@ -312,17 +268,8 @@ with the DOM attribute or property of the element. {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L60-L65" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Identify the email text box -email_txt = driver.find_element(By.NAME, "email_input") - -# Fetch the value property associated with the textbox -value_info = email_txt.get_attribute("value") - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L44-L46" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L63" >}} diff --git a/website_and_docs/content/documentation/webdriver/elements/information.zh-cn.md b/website_and_docs/content/documentation/webdriver/elements/information.zh-cn.md index e5ca661fe87b..d603062dba81 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.zh-cn.md @@ -23,14 +23,8 @@ description: > {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L20-L25" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Get boolean value for is element display -is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L12-L15" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L18-L23" >}} @@ -61,14 +55,8 @@ val flag = driver.findElement(By.name("email_input")).isDisplayed() {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L27-L30" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns true if element is enabled else returns false -value = driver.find_element(By.NAME, 'button_input').is_enabled() - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L19" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L25-L28" >}} @@ -100,14 +88,8 @@ val attr = driver.findElement(By.name("button_input")).isEnabled() {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L32-L35" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns true if element is checked else returns false -value = driver.find_element(By.NAME, "checkbox_input").is_selected() - +{{< tab header="Python" text=true >}} + {{< gh-codeblock path="examples/python/tests/elements/test_information.py#L23" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L30-L33" >}} @@ -137,14 +119,8 @@ val attr = driver.findElement(By.name("checkbox_input")).isSelected() {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L37-L40" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns TagName of the element -attr = driver.find_element(By.NAME, "email_input").tag_name - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L27" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L35-L38" >}} @@ -181,14 +157,8 @@ val attr = driver.findElement(By.name("email_input")).getTagName() {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L42-L46" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Returns height, width, x and y coordinates referenced element -res = driver.find_element(By.NAME, "range_input").rect - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L31" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L40-L47" >}} @@ -221,15 +191,9 @@ println(res.getX()) {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L49-L51" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to Url -driver.get('https://www.selenium.dev/selenium/web/colorPage.html') - -# Retrieves the computed style property 'color' of linktext -cssValue = driver.find_element(By.ID, "namedColor").value_of_css_property('background-color') - -{{< /tab >}} +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L35-L37" >}} +{{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L49-L51" >}} {{< /tab >}} @@ -259,14 +223,8 @@ val cssValue = driver.findElement(By.id("namedColor")).getCssValue("background-c {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L54-L57" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to url -driver.get("https://www.selenium.dev/selenium/web/linked_image.html") - -# Retrieves the text of the element -text = driver.find_element(By.ID, "justanotherlink").text - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L41" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L53-L56" >}} @@ -297,17 +255,8 @@ val text = driver.findElement(By.id("justanotherlink")).getText() {{< tab header="Java" text=true >}} {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L60-L65" >}} {{< /tab >}} -{{< tab header="Python" >}} - -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html") - -# Identify the email text box -email_txt = driver.find_element(By.NAME, "email_input") - -# Fetch the value property associated with the textbox -value_info = email_txt.get_attribute("value") - +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L44-L46" >}} {{< /tab >}} {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L63" >}} @@ -327,4 +276,4 @@ driver.get("https://www.selenium.dev/selenium/web/inputs.html") val attr = driver.findElement(By.name("email_input")).getAttribute("value") {{< /tab >}} -{{< /tabpane >}} \ No newline at end of file +{{< /tabpane >}}