Skip to content

Enchanced caching

Latest

Choose a tag to compare

@jlstewart379 jlstewart379 released this 08 Jan 23:12
· 18 commits to master since this release

This version released Jan. 8, 2014 includes a mechanism to cache the page source between page object loads. Previously, elements would ask Selenium for the page source each time those elements were accessed. Now, if the page object has not changed since an element from the same page object was requested the element gets it's result from the cached page source instead of asking selenium to generate a new one.

Also added a custom waiter that refreshes the page source data between iterations. The Rufus::Waiter object accepts the Rufus::Driver and options for timeout and search interval. The until instance method takes a block. The options are optional. The default timeout is 5 seconds, the default search interval is 0.2 second.

Example usage of Rufus::Waiter

    driver = Rufus::Driver.new
    wait = Rufus::Waiter.new driver, :timeout => 5, :interval => 1
    wait.until{view.enabled?}

The above code creates a new Rufus::Waiter object which will wait for five seconds for view.enabled? to evaluate to true. After five seconds the result will return false. The wait object checks the view's enabled? status every one second … this is the interval parameter.