From f3ab474eff572c84b875a182a228c034f4318e46 Mon Sep 17 00:00:00 2001 From: harsha509 Date: Fri, 20 Oct 2023 16:08:57 -0400 Subject: [PATCH] [JS] Link element information code samples to github [deploy site] --- .../webdriver/elements/information.en.md | 45 +++++-------------- .../webdriver/elements/information.ja.md | 45 +++++-------------- .../webdriver/elements/information.pt-br.md | 45 +++++-------------- .../webdriver/elements/information.zh-cn.md | 45 +++++-------------- 4 files changed, 48 insertions(+), 132 deletions(-) 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 9f0f5d963633..25289370d84c 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.en.md @@ -266,13 +266,9 @@ driver.get 'https://www.selenium.dev/selenium/web/inputs.html' # Returns height, width, x and y coordinates referenced element res = driver.find_element(name: "range_input").rect {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to url -await driver.get('https://www.selenium.dev/selenium/web/inputs.html'); - -// Returns height, width, x and y coordinates referenced element -let element = await driver.findElement(By.name("range_input")).getRect(); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L45">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to url driver.get("https://www.selenium.dev/selenium/web/inputs.html") @@ -328,15 +324,9 @@ driver.get 'https://www.selenium.dev/selenium/web/colorPage.html' cssValue = driver.find_element(:id, 'namedColor').css_value('background-color') {{< /tab >}} - {{< tab header="JavaScript" >}} - -// Navigate to Url -await driver.get('https://www.selenium.dev/selenium/web/colorPage.html'); - -// Retrieves the computed style property 'color' of linktext -let cssValue = await driver.findElement(By.id("namedColor")).getCssValue('background-color'); - - {{< /tab >}} + {{< tab header="JavaScript" text=true >}} + {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L76-L78">}} + {{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to Url @@ -382,13 +372,9 @@ driver.get 'https://www.selenium.dev/selenium/web/linked_image.html' # Retrieves the text of the element text = driver.find_element(:id, 'justanotherlink').text {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to URL -await driver.get('https://www.selenium.dev/selenium/web/linked_image.html'); - -// retrieves the text of the element -let text = await driver.findElement(By.id('justanotherlink')).getText(); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L84-L86">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to URL driver.get("https://www.selenium.dev/selenium/web/linked_image.html") @@ -448,16 +434,9 @@ email_element=driver.find_element(name: 'email_input') #fetch the value property associated with the textbox emailVal = email_element.attribute("value"); {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to the Url -await driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -// identify the email text box -const emailElement = await driver.findElements(By.xpath('//input[@name="email_input"]')); - -//fetch the attribute "name" associated with the textbox -const nameAttribute = await emailElement.getAttribute("name"); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L55-L59">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to URL driver.get("https://www.selenium.dev/selenium/web/inputs.html") 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 6d4c92aec872..b6dcd3aaa643 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.ja.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.ja.md @@ -255,13 +255,9 @@ driver.get 'https://www.selenium.dev/selenium/web/inputs.html' # Returns height, width, x and y coordinates referenced element res = driver.find_element(name: "range_input").rect {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to url -await driver.get('https://www.selenium.dev/selenium/web/inputs.html'); - -// Returns height, width, x and y coordinates referenced element -let element = await driver.findElement(By.name("range_input")).getRect(); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L45">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to url driver.get("https://www.selenium.dev/selenium/web/inputs.html") @@ -315,15 +311,9 @@ driver.get 'https://www.selenium.dev/selenium/web/colorPage.html' cssValue = driver.find_element(:id, 'namedColor').css_value('background-color') {{< /tab >}} - {{< tab header="JavaScript" >}} - -// Navigate to Url -await driver.get('https://www.selenium.dev/selenium/web/colorPage.html'); - -// Retrieves the computed style property 'color' of linktext -let cssValue = await driver.findElement(By.id("namedColor")).getCssValue('background-color'); - - {{< /tab >}} + {{< tab header="JavaScript" text=true >}} + {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L76-L78">}} + {{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to Url @@ -369,13 +359,9 @@ driver.get 'https://www.selenium.dev/selenium/web/linked_image.html' # Retrieves the text of the element text = driver.find_element(:id, 'justanotherlink').text {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to URL -await driver.get('https://www.selenium.dev/selenium/web/linked_image.html'); - -// retrieves the text of the element -let text = await driver.findElement(By.id('justanotherlink')).getText(); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L84-L86">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to URL driver.get("https://www.selenium.dev/selenium/web/linked_image.html") @@ -432,16 +418,9 @@ email_element=driver.find_element(name: 'email_input') #fetch the value property associated with the textbox emailVal = email_element.attribute("value"); {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to the Url -await driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -// identify the email text box -const emailElement = await driver.findElements(By.xpath('//input[@name="email_input"]')); - -//fetch the attribute "name" associated with the textbox -const nameAttribute = await emailElement.getAttribute("name"); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L55-L59">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to URL driver.get("https://www.selenium.dev/selenium/web/inputs.html") 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 c0ec4d9f9bb2..2e522cddb783 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 @@ -262,13 +262,9 @@ driver.get 'https://www.selenium.dev/selenium/web/inputs.html' # Returns height, width, x and y coordinates referenced element res = driver.find_element(name: "range_input").rect {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to url -await driver.get('https://www.selenium.dev/selenium/web/inputs.html'); - -// Returns height, width, x and y coordinates referenced element -let element = await driver.findElement(By.name("range_input")).getRect(); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L45">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to url driver.get("https://www.selenium.dev/selenium/web/inputs.html") @@ -323,15 +319,9 @@ driver.get 'https://www.selenium.dev/selenium/web/colorPage.html' cssValue = driver.find_element(:id, 'namedColor').css_value('background-color') {{< /tab >}} - {{< tab header="JavaScript" >}} - -// Navigate to Url -await driver.get('https://www.selenium.dev/selenium/web/colorPage.html'); - -// Retrieves the computed style property 'color' of linktext -let cssValue = await driver.findElement(By.id("namedColor")).getCssValue('background-color'); - - {{< /tab >}} + {{< tab header="JavaScript" text=true >}} + {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L76-L78">}} + {{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to Url @@ -378,13 +368,9 @@ driver.get 'https://www.selenium.dev/selenium/web/linked_image.html' # Retrieves the text of the element text = driver.find_element(:id, 'justanotherlink').text {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to URL -await driver.get('https://www.selenium.dev/selenium/web/linked_image.html'); - -// retrieves the text of the element -let text = await driver.findElement(By.id('justanotherlink')).getText(); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L84-L86">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to URL driver.get("https://www.selenium.dev/selenium/web/linked_image.html") @@ -441,16 +427,9 @@ email_element=driver.find_element(name: 'email_input') #fetch the value property associated with the textbox emailVal = email_element.attribute("value"); {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to the Url -await driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -// identify the email text box -const emailElement = await driver.findElements(By.xpath('//input[@name="email_input"]')); - -//fetch the attribute "name" associated with the textbox -const nameAttribute = await emailElement.getAttribute("name"); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L55-L59">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to URL driver.get("https://www.selenium.dev/selenium/web/inputs.html") 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 f61a70155a88..9b96969300df 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 @@ -246,13 +246,9 @@ driver.get 'https://www.selenium.dev/selenium/web/inputs.html' # Returns height, width, x and y coordinates referenced element res = driver.find_element(name: "range_input").rect {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to url -await driver.get('https://www.selenium.dev/selenium/web/inputs.html'); - -// Returns height, width, x and y coordinates referenced element -let element = await driver.findElement(By.name("range_input")).getRect(); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L45">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to url driver.get("https://www.selenium.dev/selenium/web/inputs.html") @@ -307,15 +303,9 @@ driver.get 'https://www.selenium.dev/selenium/web/colorPage.html' cssValue = driver.find_element(:id, 'namedColor').css_value('background-color') {{< /tab >}} - {{< tab header="JavaScript" >}} - -// Navigate to Url -await driver.get('https://www.selenium.dev/selenium/web/colorPage.html'); - -// Retrieves the computed style property 'color' of linktext -let cssValue = await driver.findElement(By.id("namedColor")).getCssValue('background-color'); - - {{< /tab >}} + {{< tab header="JavaScript" text=true >}} + {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L76-L78">}} + {{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to Url @@ -362,13 +352,9 @@ driver.get 'https://www.selenium.dev/selenium/web/linked_image.html' # Retrieves the text of the element text = driver.find_element(:id, 'justanotherlink').text {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to URL -await driver.get('https://www.selenium.dev/selenium/web/linked_image.html'); - -// retrieves the text of the element -let text = await driver.findElement(By.id('justanotherlink')).getText(); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L84-L86">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to URL driver.get("https://www.selenium.dev/selenium/web/linked_image.html") @@ -424,16 +410,9 @@ email_element=driver.find_element(name: 'email_input') #fetch the value property associated with the textbox emailVal = email_element.attribute("value"); {{< /tab >}} - {{< tab header="JavaScript" >}} -// Navigate to the Url -await driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -// identify the email text box -const emailElement = await driver.findElements(By.xpath('//input[@name="email_input"]')); - -//fetch the attribute "name" associated with the textbox -const nameAttribute = await emailElement.getAttribute("name"); - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L55-L59">}} +{{< /tab >}} {{< tab header="Kotlin" >}} // Navigate to URL driver.get("https://www.selenium.dev/selenium/web/inputs.html")