ruby - click method not supported for safari 6 -


i want write automation script in selenium ruby safari(version 6).but click method of selenium not supported safari version 6 there other way click selenium element.

thanks.

you can use javascript instead same. following java equivalent produce click. should able convert ruby.

javascriptexecutor js = (javascriptexecutor) driver;     string script =         "var elem = document.getelementbyid('element_id');"+         "if( document.createevent) {"+         "var evobj = document.createevent('mouseevents');"+         "evobj.initevent( 'click', true, false );"+         "elem.dispatchevent(evobj);"+         "} else if( document.createeventobject ) {"+         "elem.fireevent('onclick');"+         "}";     js.executescript(script); 

reference

ruby equivalent

script =    "var elem = document.getelementbyid('element_id');"+             "if( document.createevent) {"+             "var evobj = document.createevent('mouseevents');"+             "evobj.initevent( 'click', true, false );"+             "elem.dispatchevent(evobj);"+             "} else if( document.createeventobject ) {"+             "elem.fireevent('onclick');"+             "}"; driver.execute_script(script); 

ps: java guy , not familiar ruby.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -