Please submit a Pull Request - https://github.com/watir/watir#note-on-patchespull-requests
On Saturday, April 29, 2017 at 3:33:07 PM UTC-5, [email protected] wrote: > > I'd like to suggest a minor update to Watir::Element#flash > > I have added three parameters to remove the hard coded values only. I > gave them defaults so if not provided the function is backwards compatible. > > But this allows the external caller to choose what color they want to > flash the element , how many time, and how fast. > > # > # Flashes (change background color to a new color and back a few > times) element. > # > # @examples > # browser.text_field(name: "new_user_first_name").flash > # browser.text_field(name: > "new_user_first_name").flash("green",3,0.05) > # > > def flash(color="yellow",flashes=5,delay=0.1) > background_color = style("backgroundColor") > element_color = > driver.execute_script("arguments[0].style.backgroundColor", @element) > > flashes.times do |n| > nextcolor = (n % 2 == 0) ? color : background_color > driver.execute_script("arguments[0].style.backgroundColor = > '#{nextcolor}'", @element) > sleep(delay) > end > > driver.execute_script("arguments[0].style.backgroundColor = > arguments[1]", @element, element_color) > > self > end > > -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
