-
Notifications
You must be signed in to change notification settings - Fork 4
Console
Invoke the console from the base of your project directory, and then enter the ‘irb START’ command as directed. (Yes, this is case sensitive.)
> script\console Type 'irb START' at the prompt. >> irb START
The console will start up a browser, according to your project’s browser configuration settings. And then it will place you in an execution context. You can enter the same methods and commands that you can use in your steps or specs.
You can use this tool to exercise your pages and methods and experiment with how to use Watir to drive your application.
Additional commands have also been provided to help you navigate and debug your artifacts.
-
pages
– lists all the pages that are defined -
some_page.elements
– lists the elements defined for a page -
some_page.fields
– lists the fields defined for a page -
some_page.elements_exist?
– lists the elements defined for a page that exist on the current page
You can improve the format of the results of these commands by using the “y” prefix.
>> pages => ["empty_cart_page", "login_page", "new_product_page", "product_listing_page", "show_product_page", "store_page", "your_cart_page"] >> y pages --- - empty_cart_page - login_page - new_product_page - product_listing_page - show_product_page - store_page - your_cart_page => nil
If you get an error attempting to use ‘y’ to provide better output formatting, you need to type require 'pp'
before running these commands to use the ‘print pretty’ functionality included with Ruby to be used.
All of the commands that you enter in the console will be archived to the end of the console.log file.