Automation · Jazzez · jquery · QA · Ruby · selenium · selenium-webdriver · watir-webdriver

Watir Webdriver and JQuery

Most of the time in internet explorer, JQuery automation is little bit tricky and we need to use some methods like below only for IE browsers.

Put the below methods in to your library folder

def trigger_jquery_change(element)
$browser.execute_script(“$(‘##{element}’).change()”)
end

def trigger_jquery_onblur(element)
$browser.execute_script(“$(‘##{element}’).blur()”)
end
Script section(Including page object)

@SOME_SELECT_FIELD=$browser.select_list(:id,’ID_OF_THE_TEXT_FIELD’)

@SOME_SELECT_FIELD.when_present.select(@ANY_OPTION)
if @browser_name == “ie”
trigger_jquery_change(@SOME_SELECT_FIELD)
end

if @browser_name == “ie”
trigger_jquery_onblur(@SOME_SELECT_FIELD)
end

 

I hope there is no need to explain this code. if required please feel free to end mail to jazzezravi@gmail.com

Advertisements
Auto Complete · Slider · Testing · watir · watir-webdriver

Automate JQuery Slider using Watir-WebDriver

Automate JQuery Slider using Watir-WebDriver:

Example Code:

require ‘rubygems’
require ‘watir-webdriver’

ie=Watir::Browser.new :ie
ie.goto(“http://jqueryui.com/demos/slider/”)
ie.link(:class,’ui-slider-handle ui-state-default ui-corner-all’).focus
ie.send_keys(:arrow_down)
ie.send_keys(:page_down)
ie.send_keys(:arrow_up)
ie.send_keys(:page_up)

 

Demo Output Video  —  http://bit.ly/j_slider