diff --git a/examples/ruby/spec/elements/information_spec.rb b/examples/ruby/spec/elements/information_spec.rb index 69b06716a2b0..b3e159d3e06e 100644 --- a/examples/ruby/spec/elements/information_spec.rb +++ b/examples/ruby/spec/elements/information_spec.rb @@ -4,4 +4,48 @@ RSpec.describe 'Element Information' do let(:driver) { start_session } + let(:url) { 'https://www.selenium.dev/selenium/web/inputs.html' } + + before { driver.get(url) } + + it 'checks if an element is displayed' do + displayed_value = driver.find_element(name: 'email_input').displayed? + expect(displayed_value).to be_truthy + end + + it 'checks if an element is enabled' do + enabled_value = driver.find_element(name: 'email_input').enabled? + expect(enabled_value).to be_truthy + end + + it 'checks if an element is selected' do + selected_value = driver.find_element(name: 'email_input').selected? + expect(selected_value).to be_falsey + end + + it 'gets the tag name of an element' do + tag_name = driver.find_element(name: 'email_input').tag_name + expect(tag_name).not_to be_empty + end + + it 'gets the size and position of an element' do + size = driver.find_element(name: 'email_input').size + expect(size.width).to be_positive + expect(size.height).to be_positive + end + + it 'gets the css value of an element' do + css_value = driver.find_element(name: 'email_input').css_value('background-color') + expect(css_value).not_to be_empty + end + + it 'gets the text of an element' do + text = driver.find_element(xpath: '//h1').text + expect(text).to eq('Testing Inputs') + end + + it 'gets the attribute value of an element' do + attribute_value = driver.find_element(name: 'number_input').attribute('value') + expect(attribute_value).not_to be_empty + end end 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 11a98ad0e58c..5db3736ede8b 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.en.md @@ -43,12 +43,8 @@ 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; {{< /tab >}} -{{< tab header="Ruby" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -#fetch display status -val = driver.find_element(name: 'email_input').displayed? +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L12">}} {{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L16-L17">}} @@ -93,13 +89,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns true if element is enabled else returns false -ele = driver.find_element(name: 'button_input').enabled? - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L17">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L23-L24">}} {{< /tab >}} @@ -139,13 +131,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns true if element is checked else returns false -ele = driver.find_element(name: "checkbox_input").selected? - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L22">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L30-L31">}} {{< /tab >}} @@ -181,13 +169,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns TagName of the element -attr = driver.find_element(name: "email_input").tag_name - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L27">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L37-L38">}} {{< /tab >}} @@ -232,13 +216,9 @@ System.Console.WriteLine(res.Location); // Returns height, width System.Console.WriteLine(res.Size); {{< /tab >}} - {{< tab header="Ruby" >}} - # 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(name: "range_input").rect - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L32">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L45">}} {{< /tab >}} @@ -281,14 +261,8 @@ driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/colorPage.html" String cssValue = driver.FindElement(By.Id("namedColor")).GetCssValue("background-color"); {{< /tab >}} - {{< tab header="Ruby" >}} - - # 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(:id, 'namedColor').css_value('background-color') - + {{< tab header="Ruby" text=true >}} + {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L38">}} {{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L76-L78">}} @@ -326,13 +300,9 @@ 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="Ruby" >}} - # Navigate to url -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="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L43">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L84-L86">}} {{< /tab >}} @@ -377,16 +347,9 @@ IWebElement emailTxt = driver.FindElement(By.Name(("email_input"))); //fetch the value property associated with the textbox String valueInfo = eleSelLink.GetAttribute("value"); {{< /tab >}} - {{< tab header="Ruby" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -#identify the email text box -email_element=driver.find_element(name: 'email_input') - -#fetch the value property associated with the textbox -emailVal = email_element.attribute("value"); - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L48">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L55-L59">}} {{< /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 0fdae06e5545..64d9809e5c8c 100644 --- a/website_and_docs/content/documentation/webdriver/elements/information.ja.md +++ b/website_and_docs/content/documentation/webdriver/elements/information.ja.md @@ -43,12 +43,8 @@ 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; {{< /tab >}} -{{< tab header="Ruby" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -#fetch display status -val = driver.find_element(name: 'email_input').displayed? +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L12">}} {{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L16-L17">}} @@ -90,13 +86,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns true if element is enabled else returns false -ele = driver.find_element(name: 'button_input').enabled? - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L17">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L23-L24">}} {{< /tab >}} @@ -134,13 +126,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns true if element is checked else returns false -ele = driver.find_element(name: "checkbox_input").selected? - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L22">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L30-L31">}} {{< /tab >}} @@ -176,13 +164,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns TagName of the element -attr = driver.find_element(name: "email_input").tag_name - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L27">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L37-L38">}} {{< /tab >}} @@ -227,13 +211,9 @@ System.Console.WriteLine(res.Location); // Returns height, width System.Console.WriteLine(res.Size); {{< /tab >}} - {{< tab header="Ruby" >}} - # 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(name: "range_input").rect - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L32">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L45">}} {{< /tab >}} @@ -275,14 +255,8 @@ driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/colorPage.html" String cssValue = driver.FindElement(By.Id("namedColor")).GetCssValue("background-color"); {{< /tab >}} - {{< tab header="Ruby" >}} - - # 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(:id, 'namedColor').css_value('background-color') - + {{< tab header="Ruby" text=true >}} + {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L38">}} {{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L76-L78">}} @@ -321,13 +295,9 @@ 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="Ruby" >}} - # Navigate to url -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="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L43">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L84-L86">}} {{< /tab >}} @@ -370,16 +340,9 @@ IWebElement emailTxt = driver.FindElement(By.Name(("email_input"))); //fetch the value property associated with the textbox String valueInfo = eleSelLink.GetAttribute("value"); {{< /tab >}} - {{< tab header="Ruby" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -#identify the email text box -email_element=driver.find_element(name: 'email_input') - -#fetch the value property associated with the textbox -emailVal = email_element.attribute("value"); - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L48">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L55-L59">}} {{< /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 a097e14ca57e..41dba8988730 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 @@ -44,12 +44,8 @@ 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; {{< /tab >}} -{{< tab header="Ruby" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -#fetch display status -val = driver.find_element(name: 'email_input').displayed? +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L12">}} {{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L16-L17">}} @@ -91,13 +87,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns true if element is enabled else returns false -ele = driver.find_element(name: 'button_input').enabled? - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L17">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L23-L24">}} {{< /tab >}} @@ -140,13 +132,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns true if element is checked else returns false -ele = driver.find_element(name: "checkbox_input").selected? - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L22">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L30-L31">}} {{< /tab >}} @@ -182,13 +170,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns TagName of the element -attr = driver.find_element(name: "email_input").tag_name - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L27">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L37-L38">}} {{< /tab >}} @@ -234,13 +218,9 @@ System.Console.WriteLine(res.Location); // Returns height, width System.Console.WriteLine(res.Size); {{< /tab >}} - {{< tab header="Ruby" >}} - # 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(name: "range_input").rect - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L32">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L45">}} {{< /tab >}} @@ -283,14 +263,8 @@ driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/colorPage.html" String cssValue = driver.FindElement(By.Id("namedColor")).GetCssValue("background-color"); {{< /tab >}} - {{< tab header="Ruby" >}} - - # 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(:id, 'namedColor').css_value('background-color') - + {{< tab header="Ruby" text=true >}} + {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L38">}} {{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L76-L78">}} @@ -329,13 +303,9 @@ 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="Ruby" >}} - # Navigate to url -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="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L43">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L84-L86">}} {{< /tab >}} @@ -378,16 +348,9 @@ IWebElement emailTxt = driver.FindElement(By.Name(("email_input"))); //fetch the value property associated with the textbox String valueInfo = eleSelLink.GetAttribute("value"); {{< /tab >}} - {{< tab header="Ruby" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -#identify the email text box -email_element=driver.find_element(name: 'email_input') - -#fetch the value property associated with the textbox -emailVal = email_element.attribute("value"); - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L48">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L55-L59">}} {{< /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 7c4ee695c628..2266a7ded41f 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 @@ -37,12 +37,8 @@ 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; {{< /tab >}} -{{< tab header="Ruby" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -#fetch display status -val = driver.find_element(name: 'email_input').displayed? +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L12">}} {{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L16-L17">}} @@ -83,13 +79,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns true if element is enabled else returns false -ele = driver.find_element(name: 'button_input').enabled? - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L17">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L23-L24">}} {{< /tab >}} @@ -126,13 +118,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns true if element is checked else returns false -ele = driver.find_element(name: "checkbox_input").selected? - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L22">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L30-L31">}} {{< /tab >}} @@ -167,13 +155,9 @@ 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="Ruby" >}} - # Navigate to url -driver.get 'https://www.selenium.dev/selenium/web/inputs.html' - - # Returns TagName of the element -attr = driver.find_element(name: "email_input").tag_name - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L27">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L37-L38">}} {{< /tab >}} @@ -218,13 +202,9 @@ System.Console.WriteLine(res.Location); // Returns height, width System.Console.WriteLine(res.Size); {{< /tab >}} - {{< tab header="Ruby" >}} - # 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(name: "range_input").rect - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L32">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L45">}} {{< /tab >}} @@ -266,14 +246,8 @@ driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/colorPage.html" String cssValue = driver.FindElement(By.Id("namedColor")).GetCssValue("background-color"); {{< /tab >}} - {{< tab header="Ruby" >}} - - # 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(:id, 'namedColor').css_value('background-color') - + {{< tab header="Ruby" text=true >}} + {{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L38">}} {{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L76-L78">}} @@ -313,13 +287,9 @@ 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="Ruby" >}} - # Navigate to url -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="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L43">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L84-L86">}} {{< /tab >}} @@ -361,16 +331,9 @@ IWebElement emailTxt = driver.FindElement(By.Name(("email_input"))); //fetch the value property associated with the textbox String valueInfo = eleSelLink.GetAttribute("value"); {{< /tab >}} - {{< tab header="Ruby" >}} -# Navigate to the url -driver.get("https://www.selenium.dev/selenium/web/inputs.html"); - -#identify the email text box -email_element=driver.find_element(name: 'email_input') - -#fetch the value property associated with the textbox -emailVal = email_element.attribute("value"); - {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="/examples/ruby/spec/elements/information_spec.rb#L48">}} +{{< /tab >}} {{< tab header="JavaScript" text=true >}} {{< gh-codeblock path="/examples/javascript/test/elements/information.spec.js#L55-L59">}} {{< /tab >}}