Class: RubySelenium
- Inherits:
-
Object
- Object
- RubySelenium
- Defined in:
- lib/RubySelenium.rb
Defined Under Namespace
Classes: SeleniumCommand, SeleniumScript
Instance Attribute Summary collapse
-
#rubyWebService ⇒ Object
Returns the value of attribute rubyWebService.
Instance Method Summary collapse
-
#assertAlert(target, value = " ") ⇒ Object
examples:.
-
#assertAttribute(target, value = " ") ⇒ Object
examples:.
-
#assertConfirmation(target, value = " ") ⇒ Object
examples:.
-
#assertEditable(target, value = " ") ⇒ Object
examples:.
-
#assertElementNotPresent(target, value = " ") ⇒ Object
examples:.
-
#assertElementPresent(target, value = " ") ⇒ Object
examples:.
-
#assertLocation(target, value = " ") ⇒ Object
examples:.
-
#assertNotEditable(target, value = " ") ⇒ Object
examples:.
-
#assertNotVisible(target, value = " ") ⇒ Object
examples:.
-
#assertSelected(target, value = " ") ⇒ Object
examples:.
-
#assertSelectOptions(target, value = " ") ⇒ Object
examples:.
-
#assertTable(target, value = " ") ⇒ Object
examples:.
-
#assertText(target, value = " ") ⇒ Object
examples:.
-
#assertTextNotPresent(target, value = " ") ⇒ Object
examples:.
-
#assertTextPresent(target, value = " ") ⇒ Object
examples:.
-
#assertTitle(target, value = " ") ⇒ Object
examples:.
-
#assertValue(target, value = " ") ⇒ Object
examples:.
-
#assertVisible(target, value = " ") ⇒ Object
examples:.
-
#chooseCancelOnNextConfirmation(target = "[empty]", value = "[empty]") ⇒ Object
Instructs Selenium to click Cancel on the next javascript confirmation dialog to be raised.
-
#click(target, value = " ") ⇒ Object
Clicks on a link, button, checkbox or radio button.
-
#clickAndWait(target, value = " ") ⇒ Object
examples:.
-
#close(target = "[empty]", value = "[empty]") ⇒ Object
Simulates the user clicking the “close” button in the titlebar of a popup window.
- #complete ⇒ Object
- #go(browser = "IE") ⇒ Object
-
#goBack(target = "[empty]", value = "[empty]") ⇒ Object
Simulates the user clicking the “back” button on their browser.
-
#initialize(test_script_name) ⇒ RubySelenium
constructor
A new instance of RubySelenium.
-
#open(target, value = " ") ⇒ Object
Opens a URL in the test frame.
-
#pause(target, value = " ") ⇒ Object
Pauses the execution of the test script for a specified amount of time.
- #ruby_selenium_script ⇒ Object
-
#select(target, value = " ") ⇒ Object
Select an option from a drop-down, based on a Select Option Specifier.
-
#selectAndWait(target, value = " ") ⇒ Object
examples:.
-
#selectWindow(target, value = " ") ⇒ Object
Selects a popup window.
-
#store(target, value = " ") ⇒ Object
Stores the value of a parameter into a variable target: The value to store.
-
#storeText(target, value = " ") ⇒ Object
Stores the text of an element into a variable.
-
#storeValue(target, value = " ") ⇒ Object
Stores the value of an input field into a variable.
-
#type(target, value = " ") ⇒ Object
Types (enters) text into an input field.
-
#typeAndWait(target, value = " ") ⇒ Object
examples:.
-
#verifyAlert(target, value = " ") ⇒ Object
Verifies that a javascript alert was generated and that the text of the alert was as specified.
-
#verifyAttribute(target, value = " ") ⇒ Object
Verifies the value of an element attribute.
-
#verifyConfirmation(target, value = " ") ⇒ Object
Verifies that a javascript confirmation dialog was generated and that the text of the dialog was as specified.
-
#verifyEditable(target, value = " ") ⇒ Object
Verifies that the specified element is editable, ie.
-
#verifyElementNotPresent(target, value = " ") ⇒ Object
Verifies that the specified element is not on the page.
-
#verifyElementPresent(target, value = " ") ⇒ Object
Verifies that the specified element is somewhere on the page.
-
#verifyLocation(target, value = " ") ⇒ Object
Verifies the location of the current page being tested.
-
#verifyNotEditable(target, value = " ") ⇒ Object
Verifies that the specified element is NOT editable, ie.
-
#verifyNotVisible(target, value = " ") ⇒ Object
Verifies that the specified element is not visible.
-
#verifySelected(target, value = " ") ⇒ Object
Verifies that the selected option of a drop-down satisfies a specified Select Option Specifier.
-
#verifySelectOptions(target, value = " ") ⇒ Object
Verifies the labels of all options in a drop-down against a comma-separated list.
-
#verifyTable(target, value = " ") ⇒ Object
Verifies the text in a cell of a table.
-
#verifyText(target, value = " ") ⇒ Object
Verifies the text of an element.
-
#verifyTextNotPresent(target, value = " ") ⇒ Object
Verifies that the specified text does not appears anywhere on the rendered page.
-
#verifyTextPresent(target, value = " ") ⇒ Object
Verifies that the specified text appears somewhere on the rendered page shown to the user.
-
#verifyTitle(target, value = " ") ⇒ Object
Verifies the title of the current page.
-
#verifyValue(target, value = " ") ⇒ Object
Verifies the value of an input field (or anything else with a value parameter).
-
#verifyVisible(target, value = " ") ⇒ Object
Verifies that the specified element is both present and visible.
-
#waitForValue(target, value = " ") ⇒ Object
Waits for a specified input (e.g. a hidden field) to have a specified value.
Constructor Details
#initialize(test_script_name) ⇒ RubySelenium
Returns a new instance of RubySelenium.
258 259 260 261 262 |
# File 'lib/RubySelenium.rb', line 258 def initialize(test_script_name) @test_script_name = test_script_name @test_script_commands = [] @rubyWebService = WEBSERVICE_LOCATION end |
Instance Attribute Details
#rubyWebService ⇒ Object
Returns the value of attribute rubyWebService.
254 255 256 |
# File 'lib/RubySelenium.rb', line 254 def rubyWebService @rubyWebService end |
Instance Method Details
#assertAlert(target, value = " ") ⇒ Object
examples:
selenium.assertAlert(“Invalid Phone Number”)
744 745 746 |
# File 'lib/RubySelenium.rb', line 744 def assertAlert(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertAlert"._h(target,value) ) end |
#assertAttribute(target, value = " ") ⇒ Object
examples:
selenium.assertAttribute(“document.images@alt”, “alt-text”)
555 556 557 |
# File 'lib/RubySelenium.rb', line 555 def assertAttribute(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertAttribute"._h(target,value) ) end |
#assertConfirmation(target, value = " ") ⇒ Object
examples:
selenium.assertConfirmation(“Invalid Phone Number”)
772 773 774 |
# File 'lib/RubySelenium.rb', line 772 def assertConfirmation(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertConfirmation"._h(target,value) ) end |
#assertEditable(target, value = " ") ⇒ Object
examples:
selenium.assertEditable(“shape”)
701 702 703 |
# File 'lib/RubySelenium.rb', line 701 def assertEditable(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertEditable"._h(target,value) ) end |
#assertElementNotPresent(target, value = " ") ⇒ Object
examples:
selenium.assertElementNotPresent(“cancelButton”
627 628 629 |
# File 'lib/RubySelenium.rb', line 627 def assertElementNotPresent(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertElementNotPresent"._h(target,value) ) end |
#assertElementPresent(target, value = " ") ⇒ Object
examples:
609 610 611 |
# File 'lib/RubySelenium.rb', line 609 def assertElementPresent(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertElementPresent"._h(target,value) ) end |
#assertLocation(target, value = " ") ⇒ Object
examples:
selenium.assertLocation(“/mypage”)
442 443 444 |
# File 'lib/RubySelenium.rb', line 442 def assertLocation(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertLocation"._h(target,value) ) end |
#assertNotEditable(target, value = " ") ⇒ Object
examples:
selenium.assertNotEditable(“creditLimit”)
719 720 721 |
# File 'lib/RubySelenium.rb', line 719 def assertNotEditable(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertNotEditable"._h(target,value) ) end |
#assertNotVisible(target, value = " ") ⇒ Object
examples:
selenium.assertNotVisible(“postcode”)
683 684 685 |
# File 'lib/RubySelenium.rb', line 683 def assertNotVisible(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertNotVisible"._h(target,value) ) end |
#assertSelected(target, value = " ") ⇒ Object
examples:
selenium.assertSelected(“document.forms.dropDown”, “label=J* Smith”)
497 498 499 |
# File 'lib/RubySelenium.rb', line 497 def assertSelected(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertSelected"._h(target,value) ) end |
#assertSelectOptions(target, value = " ") ⇒ Object
examples:
selenium.assertSelectOptions(“document.forms.dropDown”, “Smith, J,Bird, D”)
515 516 517 |
# File 'lib/RubySelenium.rb', line 515 def assertSelectOptions(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertSelectOptions"._h(target,value) ) end |
#assertTable(target, value = " ") ⇒ Object
examples:
selenium.assertTable(“results.0.2”, “13”)
645 646 647 |
# File 'lib/RubySelenium.rb', line 645 def assertTable(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertTable"._h(target,value) ) end |
#assertText(target, value = " ") ⇒ Object
examples:
selenium.assertText(“//div//h1”, “Successful”)
535 536 537 |
# File 'lib/RubySelenium.rb', line 535 def assertText(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertText"._h(target,value) ) end |
#assertTextNotPresent(target, value = " ") ⇒ Object
examples:
selenium.assertTextNotPresent(“You are now logged in.”
591 592 593 |
# File 'lib/RubySelenium.rb', line 591 def assertTextNotPresent(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertTextNotPresent"._h(target,value) ) end |
#assertTextPresent(target, value = " ") ⇒ Object
examples:
selenium.assertTextPresent(“You are now logged in.”
573 574 575 |
# File 'lib/RubySelenium.rb', line 573 def assertTextPresent(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertTextPresent"._h(target,value) ) end |
#assertTitle(target, value = " ") ⇒ Object
examples:
selenium.assertTitle(“My Page”)
460 461 462 |
# File 'lib/RubySelenium.rb', line 460 def assertTitle(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertTitle"._h(target,value) ) end |
#assertValue(target, value = " ") ⇒ Object
examples:
selenium.assertValue(“document.forms.nameField”, “John Smith”)
479 480 481 |
# File 'lib/RubySelenium.rb', line 479 def assertValue(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertValue"._h(target,value) ) end |
#assertVisible(target, value = " ") ⇒ Object
examples:
selenium.assertVisible(“postcode”)
665 666 667 |
# File 'lib/RubySelenium.rb', line 665 def assertVisible(target,value = " ") @test_script_commands << SeleniumCommand.new( "assertVisible"._h(target,value) ) end |
#chooseCancelOnNextConfirmation(target = "[empty]", value = "[empty]") ⇒ Object
Instructs Selenium to click Cancel on the next javascript confirmation dialog to be raised. By default, the confirm function will return true, having the same effect as manually clicking OK. After running this command, the next confirmation will behave as if the user had clicked Cancel. target: ignored value: ignored
examples:
selenium.chooseCancelOnNextConfirmation
785 786 787 |
# File 'lib/RubySelenium.rb', line 785 def chooseCancelOnNextConfirmation(target = "[empty]",value = "[empty]") @test_script_commands << SeleniumCommand.new( "chooseCancelOnNextConfirmation"._h(target,value) ) end |
#click(target, value = " ") ⇒ Object
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), use “clickAndWait”. target: The id of the element that should be clicked. value: ignored
examples:
selenium.click(“aCheckbox”)
Selenium will always automatically click on a popup dialog raised by the alert() or confirm() methods. (The exception is those raised during ‘onload’, which are not yet handled by Selenium). You must use [verify|assert]Alert or [verify|assert]Confirmation to tell Selenium that you expect the popup dialog. You may use chooseCancelOnNextConfirmation to click ‘cancel’ on the next confirmation dialog instead of clicking ‘OK’.
307 308 309 |
# File 'lib/RubySelenium.rb', line 307 def click(target,value = " ") @test_script_commands << SeleniumCommand.new( "click"._h(target,value) ) end |
#clickAndWait(target, value = " ") ⇒ Object
examples:
selenium.clickAndWait(“submitButton”)
314 315 316 |
# File 'lib/RubySelenium.rb', line 314 def clickAndWait(target,value = " ") @test_script_commands << SeleniumCommand.new( "clickAndWait"._h(target,value) ) end |
#close(target = "[empty]", value = "[empty]") ⇒ Object
Simulates the user clicking the “close” button in the titlebar of a popup window. target: ignored value: ignored
examples:
selenium.close
389 390 391 |
# File 'lib/RubySelenium.rb', line 389 def close(target = "[empty]",value = "[empty]") @test_script_commands << SeleniumCommand.new( "close"._h(target,value) ) end |
#complete ⇒ Object
793 794 795 796 797 798 |
# File 'lib/RubySelenium.rb', line 793 def complete generator = HTML_File_Generator.new(ruby_selenium_script) generator.create_single_script_file generator.create_test_runner_file generator.create_test_suite_file end |
#go(browser = "IE") ⇒ Object
800 801 802 803 804 |
# File 'lib/RubySelenium.rb', line 800 def go(browser = "IE") if browser == "IE" then myBrowser = IE_PATH elsif browser == "FireFox" then myBrowser = FF_PATH end complete Thread.new{system("#{myBrowser} #{GO_PATH}/tests/seleniumTestRunner.html?auto=true")} end |
#goBack(target = "[empty]", value = "[empty]") ⇒ Object
Simulates the user clicking the “back” button on their browser. target: ignored value: ignored
examples:
selenium.goBack
378 379 380 |
# File 'lib/RubySelenium.rb', line 378 def goBack(target = "[empty]",value = "[empty]") @test_script_commands << SeleniumCommand.new( "goBack"._h(target,value) ) end |
#open(target, value = " ") ⇒ Object
Opens a URL in the test frame. This accepts both relative and absolute URLs. Note: The URL must be on the same site as Selenium due to security restrictions in the browser (Cross Site Scripting). target: The URL to open. value: ignored
examples:
selenium.open(“/mypage”) selenium.open(“localhost/”)
273 274 275 |
# File 'lib/RubySelenium.rb', line 273 def open(target,value = " ") @test_script_commands << SeleniumCommand.new( "open"._h(target,value) ) end |
#pause(target, value = " ") ⇒ Object
Pauses the execution of the test script for a specified amount of time. This is useful for debugging a script or pausing to wait for some server side action. target: The number of milliseconds to pause. value: ignored
examples:
selenium.pause(“5000”)
356 357 358 |
# File 'lib/RubySelenium.rb', line 356 def pause(target,value = " ") @test_script_commands << SeleniumCommand.new( "pause"._h(target,value) ) end |
#ruby_selenium_script ⇒ Object
789 790 791 |
# File 'lib/RubySelenium.rb', line 789 def ruby_selenium_script SeleniumScript.new(@test_script_name, @test_script_commands) end |
#select(target, value = " ") ⇒ Object
Select an option from a drop-down, based on a Select Option Specifier. target: An Element Locator specifying an HTML Select element. value: An Option Specifier. If more than one option matches (e.g. due to the use of globs like “f*b*”, or due to more than one option having the same label or value), then the first option that matches is selected.
examples:
selenium.select(“dropDown”, “Australian Dollars”)
326 327 328 |
# File 'lib/RubySelenium.rb', line 326 def select(target,value = " ") @test_script_commands << SeleniumCommand.new( "select"._h(target,value) ) end |
#selectAndWait(target, value = " ") ⇒ Object
examples:
selenium.selectAndWait(“currencySelector”,“AUD”)
333 334 335 |
# File 'lib/RubySelenium.rb', line 333 def selectAndWait(target,value = " ") @test_script_commands << SeleniumCommand.new( "selectAndWait"._h(target,value) ) end |
#selectWindow(target, value = " ") ⇒ Object
Selects a popup window. Once a popup window has been selected, all commands go to that window. To select the main window again, use “null” as the target. target: The id of the window to select. value: ignored
examples:
selenium.selectWindow(“myPopupWindow”)
345 346 347 |
# File 'lib/RubySelenium.rb', line 345 def selectWindow(target,value = " ") @test_script_commands << SeleniumCommand.new( "selectWindow"._h(target,value) ) end |
#store(target, value = " ") ⇒ Object
Stores the value of a parameter into a variable target: The value to store. This can be constructed using either variable substitution or javascript evaluation, as detailed in ‘Parameter construction and Variables’ (below). value: Name of the variable to store the value into.
examples:
selenium.store(“Mr John Smith”,“fullname”)
401 402 403 |
# File 'lib/RubySelenium.rb', line 401 def store(target,value = " ") @test_script_commands << SeleniumCommand.new( "store"._h(target,value) ) end |
#storeText(target, value = " ") ⇒ Object
Stores the text of an element into a variable. target: The id of the element. value: Name of the variable to store the element text into.
examples:
selenium.storeText(“currentDate”, “expectedStartDate”) selenium.verifyValue(“startDate”, “$expectedStartDate”)
424 425 426 |
# File 'lib/RubySelenium.rb', line 424 def storeText(target,value = " ") @test_script_commands << SeleniumCommand.new( "storeText"._h(target,value) ) end |
#storeValue(target, value = " ") ⇒ Object
Stores the value of an input field into a variable. target: The id of the input field. value: Name of the variable to store the field value into.
examples:
selenium.storeValue(“userName”, “userID”)
412 413 414 |
# File 'lib/RubySelenium.rb', line 412 def storeValue(target,value = " ") @test_script_commands << SeleniumCommand.new( "storeValue"._h(target,value) ) end |
#type(target, value = " ") ⇒ Object
Types (enters) text into an input field. This works for text fields, combo boxes, check boxes, etc. target: The id of the element where the text should be typed. value: The text that will be typed, or the value of the option selected (not the visible text).
examples:
selenium.type(“nameField”,“John Smith”
284 285 286 |
# File 'lib/RubySelenium.rb', line 284 def type(target,value = " ") @test_script_commands << SeleniumCommand.new( "type"._h(target,value) ) end |
#typeAndWait(target, value = " ") ⇒ Object
examples:
selenium.typeAndWait(“textBoxThatSubmitsOnChange”, “newValue”
291 292 293 |
# File 'lib/RubySelenium.rb', line 291 def typeAndWait(target,value = " ") @test_script_commands << SeleniumCommand.new( "typeAndWait"._h(target,value) ) end |
#verifyAlert(target, value = " ") ⇒ Object
Verifies that a javascript alert was generated and that the text of the alert was as specified. Alerts must be verified in the same order that they were generated. Verifying an alert has the same effect as manually clicking OK. If an alert is generated but you do not verify it, the next Selenium action will fail.
NOTE: under Selenium, javascript alerts will NOT pop up a visible alert dialog.
NOTE: Selenium does NOT support javascript alerts that are generated in a page’s onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until you manually click OK.
target: The expected text of the alert. value: ignored
examples:
selenium.verifyAlert(“Invalid Phone Number”)
737 738 739 |
# File 'lib/RubySelenium.rb', line 737 def verifyAlert(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyAlert"._h(target,value) ) end |
#verifyAttribute(target, value = " ") ⇒ Object
Verifies the value of an element attribute. An attribute is identified using the syntax <element-locator>@<attribute-name>. This works for all types of element locators. target: A locator string of the format <element-locator>@<attribute-name> value: The expected attribute value.
examples:
selenium.verifyAttribute(“txt1@class”, “bigAndBold”) selenium.verifyAttribute(“//img/@alt”, “alt-text”)
548 549 550 |
# File 'lib/RubySelenium.rb', line 548 def verifyAttribute(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyAttribute"._h(target,value) ) end |
#verifyConfirmation(target, value = " ") ⇒ Object
Verifies that a javascript confirmation dialog was generated and that the text of the dialog was as specified. Confirm dialogs must be verified in the same order that they were generated. By default, the confirm function will return true, having the same effect as manually clicking OK. This can be changed by prior execution of the chooseCancelOnNextConfirmation command (see below). If an confirmation is generated but you do not verify it, the next Selenium action will fail.
NOTE: under Selenium, javascript confirmations will NOT pop up a visible dialog.
NOTE: Selenium does NOT support javascript confirmations that are generated in a page’s onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until you manually click OK.
target: The expected text of the alert. value: ignored
examples:
selenium.verifyConfirmation(“Invalid Phone Number”)
765 766 767 |
# File 'lib/RubySelenium.rb', line 765 def verifyConfirmation(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyConfirmation"._h(target,value) ) end |
#verifyEditable(target, value = " ") ⇒ Object
Verifies that the specified element is editable, ie. it’s an input element, and hasn’t been disabled. target: The element that should be editable. value: ignored
examples:
selenium.verifyEditable(“shape”)
694 695 696 |
# File 'lib/RubySelenium.rb', line 694 def verifyEditable(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyEditable"._h(target,value) ) end |
#verifyElementNotPresent(target, value = " ") ⇒ Object
Verifies that the specified element is not on the page. target: The element that should not be present. value: ignored
examples:
selenium.verifyElementNotPresent(“cancelButton”)
620 621 622 |
# File 'lib/RubySelenium.rb', line 620 def verifyElementNotPresent(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyElementNotPresent"._h(target,value) ) end |
#verifyElementPresent(target, value = " ") ⇒ Object
Verifies that the specified element is somewhere on the page. target: The element that should be present. value: ignored
examples:
selenium.verifyElementPresent(“submitButton”)
602 603 604 |
# File 'lib/RubySelenium.rb', line 602 def verifyElementPresent(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyElementPresent"._h(target,value) ) end |
#verifyLocation(target, value = " ") ⇒ Object
Verifies the location of the current page being tested. target: The expected relative location of the page. value: ignored
examples:
selenium.verifyLocation(“/mypage”)
435 436 437 |
# File 'lib/RubySelenium.rb', line 435 def verifyLocation(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyLocation"._h(target,value) ) end |
#verifyNotEditable(target, value = " ") ⇒ Object
Verifies that the specified element is NOT editable, ie. it’s NOT an input element, or has been disabled. target: The element that should be read-only. value: ignored
examples:
selenium.verifyNotEditable(“creditLimit”)
712 713 714 |
# File 'lib/RubySelenium.rb', line 712 def verifyNotEditable(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyNotEditable"._h(target,value) ) end |
#verifyNotVisible(target, value = " ") ⇒ Object
Verifies that the specified element is not visible. Elements that are simply not present are also considered invisible. target: The element that should not be visible. value: ignored
examples:
selenium.verifyNotVisible(“postcode”)
676 677 678 |
# File 'lib/RubySelenium.rb', line 676 def verifyNotVisible(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyNotVisible"._h(target,value) ) end |
#verifySelected(target, value = " ") ⇒ Object
Verifies that the selected option of a drop-down satisfies a specified Select Option Specifier. target: Locates the drop-down to verify. value: A Select Option Specifier that the selected option is expected to satisfy.
examples:
selenium.verifySelected(“dropdown2”, “John Smith”)
490 491 492 |
# File 'lib/RubySelenium.rb', line 490 def verifySelected(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifySelected"._h(target,value) ) end |
#verifySelectOptions(target, value = " ") ⇒ Object
Verifies the labels of all options in a drop-down against a comma-separated list. Commas in an expected option can be escaped as “,”. target: Locates the drop-down to verify. value: A comma-separated list of option labels.
examples:
selenium.verifySelectOptions(“dropdown2”, “John Smith,Dave Bird”)
508 509 510 |
# File 'lib/RubySelenium.rb', line 508 def verifySelectOptions(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifySelectOptions"._h(target,value) ) end |
#verifyTable(target, value = " ") ⇒ Object
Verifies the text in a cell of a table. The correct syntax of the target is tableName.row.column, where row and column start at 0. target: The table, row, and column specified as table.row.col. value: The expected value of the cell.
examples:
selenium.verifyTable(“myTable.1.6”, “Submitted”)
638 639 640 |
# File 'lib/RubySelenium.rb', line 638 def verifyTable(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyTable"._h(target,value) ) end |
#verifyText(target, value = " ") ⇒ Object
Verifies the text of an element. This works for any element that contains text. This command uses either the textContent (Mozilla-like browsers) or the innerText (IE-like browsers) of the element, which is the rendered text shown to the user. target: The id of the element to verify. value: The expected text.
examples:
selenium.verifyText(“statusMessage”, “Successful”)
528 529 530 |
# File 'lib/RubySelenium.rb', line 528 def verifyText(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyText"._h(target,value) ) end |
#verifyTextNotPresent(target, value = " ") ⇒ Object
Verifies that the specified text does not appears anywhere on the rendered page. target: The text that should not be present. value: ignored
examples:
selenium.verifyTextNotPresent(“You are now logged in.”
584 585 586 |
# File 'lib/RubySelenium.rb', line 584 def verifyTextNotPresent(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyTextNotPresent"._h(target,value) ) end |
#verifyTextPresent(target, value = " ") ⇒ Object
Verifies that the specified text appears somewhere on the rendered page shown to the user. target: The text that should be present. value: ignored
examples:
selenium.verifyTextPresent(“You are now logged in.”
566 567 568 |
# File 'lib/RubySelenium.rb', line 566 def verifyTextPresent(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyTextPresent"._h(target,value) ) end |
#verifyTitle(target, value = " ") ⇒ Object
Verifies the title of the current page. target: The expected page title. value: ignored
examples:
selenium.verifyTitle(“My Page”)
453 454 455 |
# File 'lib/RubySelenium.rb', line 453 def verifyTitle(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyTitle"._h(target,value) ) end |
#verifyValue(target, value = " ") ⇒ Object
Verifies the value of an input field (or anything else with a value parameter). For checkbox/radio elements, the value will be “on” or “off” depending on whether the element is checked or not. target: The id of the element to verify. value: The expected value.
examples:
selenium.verifyValue(“nameField”, “John Smith”)
472 473 474 |
# File 'lib/RubySelenium.rb', line 472 def verifyValue(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyValue"._h(target,value) ) end |
#verifyVisible(target, value = " ") ⇒ Object
Verifies that the specified element is both present and visible. An element can be rendered invisible by setting the CSS “visibility” property to “hidden”, or the “display” property to “none”, either for the element itself or one if its ancestors. target: The element that should be visible. value: ignored
examples:
selenium.verifyVisible(“postcode”)
658 659 660 |
# File 'lib/RubySelenium.rb', line 658 def verifyVisible(target,value = " ") @test_script_commands << SeleniumCommand.new( "verifyVisible"._h(target,value) ) end |
#waitForValue(target, value = " ") ⇒ Object
Waits for a specified input (e.g. a hidden field) to have a specified value. Will succeed immediately if the input already has the value. Is implemented by polling for the value. Warning: can block indefinitely if the input never has the specified value. target: The input field. value: The value the input field must have before continuing.
example:
selenium.waitForValue(“finishIndication”, “isfinished”)
367 368 369 |
# File 'lib/RubySelenium.rb', line 367 def waitForValue(target,value = " ") @test_script_commands << SeleniumCommand.new( "waitForValue"._h(target,value) ) end |