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);
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
Post a Comment