diff --git a/website_and_docs/content/documentation/webdriver/interactions/alerts.en.md b/website_and_docs/content/documentation/webdriver/interactions/alerts.en.md index db92887bd200..8480fe78b79f 100644 --- a/website_and_docs/content/documentation/webdriver/interactions/alerts.en.md +++ b/website_and_docs/content/documentation/webdriver/interactions/alerts.en.md @@ -39,19 +39,11 @@ String text = alert.getText(); //Press the OK button alert.accept(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See an example alert").click() - -# Wait for the alert to be displayed and store it in a variable -alert = wait.until(expected_conditions.alert_is_present()) -# Store the alert text in a variable -text = alert.text +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L12-L18" >}} +{{< /tab >}} -# Press the OK button -alert.accept() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See an example alert")).Click(); @@ -78,9 +70,9 @@ alert_text = alert.text # Press on OK button alert.accept {{< /tab >}} - {{< tab header="JavaScript" text=true >}} - {{< gh-codeblock path="examples/javascript/test/interactions/alert.spec.js#L19-L21" >}} - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="examples/javascript/test/interactions/alert.spec.js#L19-L21" >}} +{{< /tab >}} {{< tab header="Kotlin" >}} //Click the link to activate the alert driver.findElement(By.linkText("See an example alert")).click() @@ -122,22 +114,11 @@ String text = alert.getText(); //Press the Cancel button alert.dismiss(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See a sample confirm").click() - -# Wait for the alert to be displayed -wait.until(expected_conditions.alert_is_present()) - -# Store the alert in a variable for reuse -alert = driver.switch_to.alert -# Store the alert text in a variable -text = alert.text +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L26-L32" >}} +{{< /tab >}} -# Press the Cancel button -alert.dismiss() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See a sample confirm")).Click(); @@ -167,9 +148,9 @@ alert_text = alert.text # Press on Cancel button alert.dismiss {{< /tab >}} - {{< tab header="JavaScript" text=true >}} - {{< gh-codeblock path="examples/javascript/test/interactions/alert.spec.js#L30-L32" >}} - {{< /tab >}} +{{< tab header="JavaScript" text=true >}} +{{< gh-codeblock path="examples/javascript/test/interactions/alert.spec.js#L30-L32" >}} +{{< /tab >}} {{< tab header="Kotlin" >}} //Click the link to activate the alert driver.findElement(By.linkText("See a sample confirm")).click() @@ -213,22 +194,11 @@ alert.sendKeys("Selenium"); //Press the OK button alert.accept(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See a sample prompt").click() - -# Wait for the alert to be displayed -wait.until(expected_conditions.alert_is_present()) - -# Store the alert in a variable for reuse -alert = Alert(driver) -# Type your message -alert.send_keys("Selenium") +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L40-L47" >}} +{{< /tab >}} -# Press the OK button -alert.accept() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See a sample prompt")).Click(); diff --git a/website_and_docs/content/documentation/webdriver/interactions/alerts.ja.md b/website_and_docs/content/documentation/webdriver/interactions/alerts.ja.md index 101500c67558..956fe747ad97 100644 --- a/website_and_docs/content/documentation/webdriver/interactions/alerts.ja.md +++ b/website_and_docs/content/documentation/webdriver/interactions/alerts.ja.md @@ -34,19 +34,11 @@ String text = alert.getText(); //Press the OK button alert.accept(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See an example alert").click() - -# Wait for the alert to be displayed and store it in a variable -alert = wait.until(expected_conditions.alert_is_present()) -# Store the alert text in a variable -text = alert.text +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L12-L18" >}} +{{< /tab >}} -# Press the OK button -alert.accept() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See an example alert")).Click(); @@ -115,22 +107,11 @@ String text = alert.getText(); //Press the Cancel button alert.dismiss(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See a sample confirm").click() - -# Wait for the alert to be displayed -wait.until(expected_conditions.alert_is_present()) - -# Store the alert in a variable for reuse -alert = driver.switch_to.alert -# Store the alert text in a variable -text = alert.text +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L26-L32" >}} +{{< /tab >}} -# Press the Cancel button -alert.dismiss() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See a sample confirm")).Click(); @@ -203,22 +184,11 @@ alert.sendKeys("Selenium"); //Press the OK button alert.accept(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See a sample prompt").click() -# Wait for the alert to be displayed -wait.until(expected_conditions.alert_is_present()) - -# Store the alert in a variable for reuse -alert = Alert(driver) - -# Type your message -alert.send_keys("Selenium") +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L40-L47" >}} +{{< /tab >}} -# Press the OK button -alert.accept() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See a sample prompt")).Click(); diff --git a/website_and_docs/content/documentation/webdriver/interactions/alerts.pt-br.md b/website_and_docs/content/documentation/webdriver/interactions/alerts.pt-br.md index e195495d8fda..447964e861c6 100644 --- a/website_and_docs/content/documentation/webdriver/interactions/alerts.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/interactions/alerts.pt-br.md @@ -38,32 +38,11 @@ String text = alert.getText(); //Press the OK button alert.accept(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See an example alert").click() - -# Wait for the alert to be displayed and store it in a variable -alert = wait.until(expected_conditions.alert_is_present()) - -# Store the alert text in a variable -text = alert.text - -# Press the OK button -alert.accept() - {{< /tab >}} - {{< tab header="CSharp" >}} -//Click the link to activate the alert -driver.FindElement(By.LinkText("See an example alert")).Click(); - -//Wait for the alert to be displayed and store it in a variable -IAlert alert = wait.Until(ExpectedConditions.AlertIsPresent()); -//Store the alert text in a variable -string text = alert.Text; +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L12-L18" >}} +{{< /tab >}} -//Press the OK button -alert.Accept(); - {{< /tab >}} {{< tab header="Ruby" >}} # Click the link to activate the alert driver.find_element(:link_text, 'See an example alert').click @@ -120,22 +99,11 @@ String text = alert.getText(); //Press the Cancel button alert.dismiss(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See a sample confirm").click() - -# Wait for the alert to be displayed -wait.until(expected_conditions.alert_is_present()) -# Store the alert in a variable for reuse -alert = driver.switch_to.alert - -# Store the alert text in a variable -text = alert.text +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L26-L32" >}} +{{< /tab >}} -# Press the Cancel button -alert.dismiss() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See a sample confirm")).Click(); @@ -210,22 +178,11 @@ alert.sendKeys("Selenium"); //Press the OK button alert.accept(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See a sample prompt").click() - -# Wait for the alert to be displayed -wait.until(expected_conditions.alert_is_present()) -# Store the alert in a variable for reuse -alert = Alert(driver) - -# Type your message -alert.send_keys("Selenium") +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L40-L47" >}} +{{< /tab >}} -# Press the OK button -alert.accept() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See a sample prompt")).Click(); diff --git a/website_and_docs/content/documentation/webdriver/interactions/alerts.zh-cn.md b/website_and_docs/content/documentation/webdriver/interactions/alerts.zh-cn.md index 3b8b4d039ac8..cc21dfbef9bd 100644 --- a/website_and_docs/content/documentation/webdriver/interactions/alerts.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/interactions/alerts.zh-cn.md @@ -31,19 +31,11 @@ String text = alert.getText(); //Press the OK button alert.accept(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See an example alert").click() - -# Wait for the alert to be displayed and store it in a variable -alert = wait.until(expected_conditions.alert_is_present()) -# Store the alert text in a variable -text = alert.text +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L12-L18" >}} +{{< /tab >}} -# Press the OK button -alert.accept() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See an example alert")).Click(); @@ -111,22 +103,11 @@ String text = alert.getText(); //Press the Cancel button alert.dismiss(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See a sample confirm").click() - -# Wait for the alert to be displayed -wait.until(expected_conditions.alert_is_present()) - -# Store the alert in a variable for reuse -alert = driver.switch_to.alert -# Store the alert text in a variable -text = alert.text +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L26-L32" >}} +{{< /tab >}} -# Press the Cancel button -alert.dismiss() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See a sample confirm")).Click(); @@ -198,22 +179,11 @@ alert.sendKeys("Selenium"); //Press the OK button alert.accept(); {{< /tab >}} - {{< tab header="Python" >}} -# Click the link to activate the alert -driver.find_element(By.LINK_TEXT, "See a sample prompt").click() -# Wait for the alert to be displayed -wait.until(expected_conditions.alert_is_present()) - -# Store the alert in a variable for reuse -alert = Alert(driver) - -# Type your message -alert.send_keys("Selenium") +{{< tab header="Python" text=true >}} +{{< gh-codeblock path="examples/python/tests/interactions/test_alerts.py#L40-L47" >}} +{{< /tab >}} -# Press the OK button -alert.accept() - {{< /tab >}} {{< tab header="CSharp" >}} //Click the link to activate the alert driver.FindElement(By.LinkText("See a sample prompt")).Click();