diff --git a/examples/dotnet/SeleniumDocs/Elements/InformationTest.cs b/examples/dotnet/SeleniumDocs/Elements/InformationTest.cs index f113bce99fee..37ad613bb7d9 100644 --- a/examples/dotnet/SeleniumDocs/Elements/InformationTest.cs +++ b/examples/dotnet/SeleniumDocs/Elements/InformationTest.cs @@ -1,9 +1,69 @@ +using System; +using System.Drawing; using Microsoft.VisualStudio.TestTools.UnitTesting; +using OpenQA.Selenium; +using OpenQA.Selenium.Chrome; + namespace SeleniumDocs.Elements { [TestClass] - public class InformationTest : BaseTest + public class InformationTest { + [TestMethod] + public void TestInformationCommands(){ + WebDriver driver = new ChromeDriver(); + driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromMilliseconds(500); + + // Navigate to Url + driver.Url= "https://www.selenium.dev/selenium/web/inputs.html"; + // isDisplayed + // Get boolean value for is element display + bool isEmailVisible = driver.FindElement(By.Name("email_input")).Displayed; + Assert.AreEqual(isEmailVisible, true); + + //isEnabled + //returns true if element is enabled else returns false + bool isEnabledButton = driver.FindElement(By.Name("button_input")).Enabled; + Assert.AreEqual(isEnabledButton, true); + + //isSelected + //returns true if element is checked else returns false + bool isSelectedCheck = driver.FindElement(By.Name("checkbox_input")).Selected; + Assert.AreEqual(isSelectedCheck, true); + + //TagName + //returns TagName of the element + string tagNameInp = driver.FindElement(By.Name("email_input")).TagName; + Assert.AreEqual(tagNameInp, "input"); + + //Get Location and Size + //Get Location + IWebElement rangeElement = driver.FindElement(By.Name("range_input")); + Point point = rangeElement.Location; + Assert.IsNotNull(point.X); + //Get Size + int height=rangeElement.Size.Height; + Assert.IsNotNull(height); + + // Retrieves the computed style property 'font-size' of field + string cssValue = driver.FindElement(By.Name("color_input")).GetCssValue("font-size"); + Assert.AreEqual(cssValue, "13.3333px"); + + //GetText + // Retrieves the text of the element + string text = driver.FindElement(By.TagName("h1")).Text; + Assert.AreEqual(text, "Testing Inputs"); + + //FetchAttributes + //identify the email text box + IWebElement emailTxt = driver.FindElement(By.Name("email_input")); + //fetch the value property associated with the textbox + string valueInfo = emailTxt.GetAttribute("value"); + Assert.AreEqual(valueInfo, "admin@localhost"); + + //Quit the driver + driver.Quit(); + } } } \ No newline at end of file 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 5db3736ede8b..96360d54cfaa 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.en.md @@ -37,11 +37,7 @@ driver.get("https://www.selenium.dev/selenium/web/inputs.html") is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() {{< /tab >}} {{< tab header="CSharp" >}} -//Navigate to the url -driver.Url = "https://www.selenium.dev/selenium/web/inputs.html"; - -//Get boolean value for is element display -Boolean is_email_visible = driver.FindElement(By.Name("email_input")).Displayed; +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L18-L23" >}} {{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L12">}} @@ -79,16 +75,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Store the WebElement -IWebElement element = driver.FindElement(By.Name("button_input")); - -// Prints true if element is enabled else returns false -System.Console.WriteLine(element.Enabled); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L25-L28" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L17">}} {{< /tab >}} @@ -124,13 +113,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Returns true if element ins checked else returns false -bool value = driver.FindElement(By.Name("checkbox_input")).Selected; - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L30-L33" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L22">}} {{< /tab >}} @@ -162,13 +147,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Returns TagName of the element -string attr = driver.FindElement(By.Name("email_input")).TagName; - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L35-L38" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L27">}} {{< /tab >}} @@ -206,16 +187,9 @@ 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="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -var res = driver.FindElement(By.Name("range_input")); -// Return x and y coordinates referenced element -System.Console.WriteLine(res.Location); -// Returns height, width -System.Console.WriteLine(res.Size); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L40-L47" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L32">}} {{< /tab >}} @@ -250,17 +224,10 @@ 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="CSharp" >}} - -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/colorPage.html"); - -// Retrieves the computed style property 'color' of linktext -String cssValue = driver.FindElement(By.Id("namedColor")).GetCssValue("background-color"); - - {{< /tab >}} +{{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L49-L51" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L38">}} {{< /tab >}} @@ -293,13 +260,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to url -driver.Url="https://www.selenium.dev/selenium/web/linked_image.html"; - -// Retrieves the text of the element -String text = driver.FindElement(By.Id("justanotherlink")).Text; - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L53-L56" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L43">}} {{< /tab >}} @@ -337,16 +300,9 @@ 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="CSharp" >}} - //Navigate to the url -driver.Url="https://www.selenium.dev/selenium/web/inputs.html"; - -//identify the email text box -IWebElement emailTxt = driver.FindElement(By.Name(("email_input"))); - -//fetch the value property associated with the textbox -String valueInfo = eleSelLink.GetAttribute("value"); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L63" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L48">}} {{< /tab >}} 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 64d9809e5c8c..e01f1f986619 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.ja.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.ja.md @@ -37,11 +37,7 @@ driver.get("https://www.selenium.dev/selenium/web/inputs.html") is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() {{< /tab >}} {{< tab header="CSharp" >}} -//Navigate to the url -driver.Url = "https://www.selenium.dev/selenium/web/inputs.html"; - -//Get boolean value for is element display -Boolean is_email_visible = driver.FindElement(By.Name("email_input")).Displayed; +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L18-L23" >}} {{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L12">}} @@ -76,16 +72,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Store the WebElement -IWebElement element = driver.FindElement(By.Name("button_input")); - -// Prints true if element is enabled else returns false -System.Console.WriteLine(element.Enabled); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L25-L28" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L17">}} {{< /tab >}} @@ -119,13 +108,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Returns true if element ins checked else returns false -bool value = driver.FindElement(By.Name("checkbox_input")).Selected; - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L30-L33" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L22">}} {{< /tab >}} @@ -158,12 +143,8 @@ driver.get("https://www.selenium.dev/selenium/web/inputs.html") attr = driver.find_element(By.NAME, "email_input").tag_name {{< /tab >}} {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Returns TagName of the element -string attr = driver.FindElement(By.Name("email_input")).TagName; - {{< /tab >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L35-L38" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L27">}} {{< /tab >}} @@ -201,16 +182,9 @@ 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="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -var res = driver.FindElement(By.Name("range_input")); -// Return x and y coordinates referenced element -System.Console.WriteLine(res.Location); -// Returns height, width -System.Console.WriteLine(res.Size); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L40-L47" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L32">}} {{< /tab >}} @@ -246,15 +220,9 @@ driver.get('https://www.selenium.dev/selenium/web/colorPage.html') cssValue = driver.find_element(By.ID, "namedColor").value_of_css_property('background-color') {{< /tab >}} - {{< tab header="CSharp" >}} - -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/colorPage.html"); - -// Retrieves the computed style property 'color' of linktext -String cssValue = driver.FindElement(By.Id("namedColor")).GetCssValue("background-color"); - - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L49-L51" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L38">}} {{< /tab >}} @@ -288,13 +256,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to url -driver.Url="https://www.selenium.dev/selenium/web/linked_image.html"; - -// Retrieves the text of the element -String text = driver.FindElement(By.Id("justanotherlink")).Text; - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L53-L56" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L43">}} {{< /tab >}} @@ -330,16 +294,9 @@ 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="CSharp" >}} - //Navigate to the url -driver.Url="https://www.selenium.dev/selenium/web/inputs.html"; - -//identify the email text box -IWebElement emailTxt = driver.FindElement(By.Name(("email_input"))); - -//fetch the value property associated with the textbox -String valueInfo = eleSelLink.GetAttribute("value"); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L63" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L48">}} {{< /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 41dba8988730..40dff38dfb1b 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 @@ -38,11 +38,7 @@ driver.get("https://www.selenium.dev/selenium/web/inputs.html") is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() {{< /tab >}} {{< tab header="CSharp" >}} -//Navigate to the url -driver.Url = "https://www.selenium.dev/selenium/web/inputs.html"; - -//Get boolean value for is element display -Boolean is_email_visible = driver.FindElement(By.Name("email_input")).Displayed; +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L18-L23" >}} {{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L12">}} @@ -77,16 +73,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Store the WebElement -IWebElement element = driver.FindElement(By.Name("button_input")); - -// Prints true if element is enabled else returns false -System.Console.WriteLine(element.Enabled); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L25-L28" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L17">}} {{< /tab >}} @@ -125,13 +114,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Returns true if element ins checked else returns false -bool value = driver.FindElement(By.Name("checkbox_input")).Selected; - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L30-L33" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L22">}} {{< /tab >}} @@ -163,13 +148,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Returns TagName of the element -string attr = driver.FindElement(By.Name("email_input")).TagName; - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L35-L38" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L27">}} {{< /tab >}} @@ -208,16 +189,9 @@ 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="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -var res = driver.FindElement(By.Name("range_input")); -// Return x and y coordinates referenced element -System.Console.WriteLine(res.Location); -// Returns height, width -System.Console.WriteLine(res.Size); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L40-L47" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L32">}} {{< /tab >}} @@ -254,15 +228,9 @@ driver.get('https://www.selenium.dev/selenium/web/colorPage.html') cssValue = driver.find_element(By.ID, "namedColor").value_of_css_property('background-color') {{< /tab >}} - {{< tab header="CSharp" >}} - -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/colorPage.html"); - -// Retrieves the computed style property 'color' of linktext -String cssValue = driver.FindElement(By.Id("namedColor")).GetCssValue("background-color"); - - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L49-L51" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L38">}} {{< /tab >}} @@ -297,12 +265,8 @@ driver.get("https://www.selenium.dev/selenium/web/linked_image.html") text = driver.find_element(By.ID, "justanotherlink").text {{< /tab >}} {{< tab header="CSharp" >}} -// Navigate to url -driver.Url="https://www.selenium.dev/selenium/web/linked_image.html"; - -// Retrieves the text of the element -String text = driver.FindElement(By.Id("justanotherlink")).Text; - {{< /tab >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L53-L56" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L43">}} {{< /tab >}} @@ -338,16 +302,9 @@ 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="CSharp" >}} - //Navigate to the url -driver.Url="https://www.selenium.dev/selenium/web/inputs.html"; - -//identify the email text box -IWebElement emailTxt = driver.FindElement(By.Name(("email_input"))); - -//fetch the value property associated with the textbox -String valueInfo = eleSelLink.GetAttribute("value"); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L63" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L48">}} {{< /tab >}} 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 2266a7ded41f..4653f0006307 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 @@ -31,11 +31,7 @@ driver.get("https://www.selenium.dev/selenium/web/inputs.html") is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed() {{< /tab >}} {{< tab header="CSharp" >}} -//Navigate to the url -driver.Url = "https://www.selenium.dev/selenium/web/inputs.html"; - -//Get boolean value for is element display -Boolean is_email_visible = driver.FindElement(By.Name("email_input")).Displayed; +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L18-L23" >}} {{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L12">}} @@ -69,16 +65,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Store the WebElement -IWebElement element = driver.FindElement(By.Name("button_input")); - -// Prints true if element is enabled else returns false -System.Console.WriteLine(element.Enabled); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L25-L28" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L17">}} {{< /tab >}} @@ -111,13 +100,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Returns true if element ins checked else returns false -bool value = driver.FindElement(By.Name("checkbox_input")).Selected; - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L30-L33" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L22">}} {{< /tab >}} @@ -148,13 +133,9 @@ 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 >}} - {{< tab header="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -// Returns TagName of the element -string attr = driver.FindElement(By.Name("email_input")).TagName; - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L35-L38" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L27">}} {{< /tab >}} @@ -192,16 +173,9 @@ 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="CSharp" >}} -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); - -var res = driver.FindElement(By.Name("range_input")); -// Return x and y coordinates referenced element -System.Console.WriteLine(res.Location); -// Returns height, width -System.Console.WriteLine(res.Size); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L40-L47" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L32">}} {{< /tab >}} @@ -237,15 +211,9 @@ driver.get('https://www.selenium.dev/selenium/web/colorPage.html') cssValue = driver.find_element(By.ID, "namedColor").value_of_css_property('background-color') {{< /tab >}} - {{< tab header="CSharp" >}} - -// Navigate to Url -driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/colorPage.html"); - -// Retrieves the computed style property 'color' of linktext -String cssValue = driver.FindElement(By.Id("namedColor")).GetCssValue("background-color"); - - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L49-L51" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L38">}} {{< /tab >}} @@ -281,12 +249,8 @@ driver.get("https://www.selenium.dev/selenium/web/linked_image.html") text = driver.find_element(By.ID, "justanotherlink").text {{< /tab >}} {{< tab header="CSharp" >}} -// Navigate to url -driver.Url="https://www.selenium.dev/selenium/web/linked_image.html"; - -// Retrieves the text of the element -String text = driver.FindElement(By.Id("justanotherlink")).Text; - {{< /tab >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L53-L56" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L43">}} {{< /tab >}} @@ -321,16 +285,9 @@ 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="CSharp" >}} - //Navigate to the url -driver.Url="https://www.selenium.dev/selenium/web/inputs.html"; - -//identify the email text box -IWebElement emailTxt = driver.FindElement(By.Name(("email_input"))); - -//fetch the value property associated with the textbox -String valueInfo = eleSelLink.GetAttribute("value"); - {{< /tab >}} + {{< tab header="CSharp" >}} +{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L63" >}} +{{< /tab >}} {{< tab header="Ruby" text=true >}} {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L48">}} {{< /tab >}}