Hi, all I am a beginner with watir. Now I am trying to make some automation test using watir + dynatrace. I meet a strange problem about selection box. The script can locate the select box but can not select. After reaching the select box it gets no response. With ie, the selection section becomes yellow and just like search for the option. And after a long time I get an error like this :
C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.2.0/lib/watir-classic/locato r.rb:129: stack level too deep (SystemStackError) The selection box is inside a fake popup window. From firebug I found it is a div. Here is the html and my script. html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <body onclick="javascript:if($('pageMessage').getStyle('display') != 'none'){$('pageMessage').toggle();};"> <div id="WzTtDiV" style="visibility: hidden; position: absolute; overflow: hidden; padding: 0px; width: 0px; left: 0px; top: 0px;"></div> <script language="javascript" type="text/javascript"> <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable" style="display: block; z-index: 1002; outline: 0px none; position: absolute; height: auto; width: 1080px; top: 0px; left: 406px;" tabindex="-1" role="dialog" aria-labelledby=" ui-dialog-title-dialog-modal"> <div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"> <div id="dialog-modal" class="ui-dialog-content ui-widget-content" style="width: auto; min-height: 0px; height: 449.733px;" scrolltop="0" scrollleft="0"> <iframe id="frModalWindow" scrolling="auto" frameborder="0" src=" http://loadchart.qa.slb.com/loadchart/timecapture/time-capture-page.htm?workPattern=2 " style="width:100%; height: 100%; min-height: 100%" marginwidth="1" marginheight="1" name="frModalWindow"> <!DOCTYPE html> <html> <head> <body> <form id="timeCapture" class="ui-input-form" action=" /loadchart/timecapture/time-capture-page.htm" name="timeCapture" method=" post"> <input id="timeCapture_form_name" type="hidden" value="timeCapture" name=" form_name"> <div class="half-day-container"> <div id="workPattern" class="workPattern" style=""> <div class="message-info"> <div id="workPatternDateSelection"> </div> <div id="tc-container" class="tc-grid-a" style="width: 100%;"> <div id="tc-ALPHAcontainer" class="tc-block-a tc-block tc-block-active" style="overflow:hidden;"> <div id="ALPHAcontainer" class="ui-content"> <div class="tc-container-header"> <div class="field-container"> <div id="timeTypeCategoryContainer"> <div class="time-type-category"> <div class="tc-label"> <div class="tc-input"> *<select id="form_timeTypeCategory" size="1" name="timeTypeCategory">* *<option value=""></option>* *<option value="802">On not working</option>* *<option value="801">On working</option>* *<option value="805">Personal leave</option>* *<option value="804">Time off</option>* *</select>* </div> </div> </div> <div id="timeTypeContainer"> </div> <div id="timeTypeDetailsContainer"></div> </div> </div> <div id="tc-BETAcontainer" class="tc-block-b tc-block" style=" overflow:hidden;"> </div> </form> </body> </html> </iframe> </div> <div class="ui-resizable-handle ui-resizable-n"></div> <div class="ui-resizable-handle ui-resizable-e"></div> <div class="ui-resizable-handle ui-resizable-s"></div> <div class="ui-resizable-handle ui-resizable-w"></div> <div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se" style="z-index: 1001;"></div> <div class="ui-resizable-handle ui-resizable-sw" style="z-index: 1002;"></ div> <div class="ui-resizable-handle ui-resizable-ne" style="z-index: 1003;"></ div> <div class="ui-resizable-handle ui-resizable-nw" style="z-index: 1004;"></ div> <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"> </div> <script language="javascript" type="text/javascript"> <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable " style="display: none; z-index: 1000; outline: 0px none;" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-dialog-message"> <script src="/loadchart/js/tooltip/wz_tooltip.js" type="text/javascript"> <input id="abstractEmployeeDateMidnightField" type="hidden" name=" abstractEmployeeDateMidnightField_field"> <div id="container"> <div class="ui-widget-overlay" style="width: 1899px; height: 595px; z-index: 1001;"></div> </body> </html> The selection box I want to select is in red. My script is like this: require 'watir' #require 'watir-webdriver' # Enabling dynaTrace AJAX Agent ENV['DT_AE_AGENTACTIVE'] = 'true' ENV['DT_AE_AGENTNAME'] = 'Watir Sample Test' # Optional dynaTrace AJAX Parameters # ENV['DT_IE_SERVER_HOST'] = 'localhost' # ENV['DT_IE_SERVER_PORT'] = '9988' ENV['DT_AE_CLEARCACHE'] = 'true' b = Watir::Browser.new b.goto('https://loadchart.qa.slb.com/') window = b.ie.Document.parentWindow b.text_field(:name, 'j_username').set 'username' b.text_field(:name, 'j_password').set 'password' b.button(:id, "submit").click b.select_list(:name, "roleSelect").select("ROLE_MANAGER") b.a(:text => "Team Calendar").click b.div(:id => "3239126").click b.a(:title => "Capture Work Pattern").click b.div(:id, "dialog-modal").frame(:id, "frModalWindow").form(:id, "timeCapture").div(:id, "workPattern").div(:id, "workPatternDateSelection").button(:id, "selectPatternButton").click sleep 5 b.div(:id, "dialog-modal").frame(:id, "frModalWindow").form(:id, "timeCapture").div(:id, "tc-container").div(:id, "tc-ALPHAcontainer").div(:id, "ALPHAcontainer").div(:class, "tc-container-header").div(:id, "workPatternContainer").text_field(:id, "form_rotationValue").set("5") #b.div(:id, "dialog-modal").frame(:id, "frModalWindow").form(:id, "timeCapture").div(:id, "tc-container").div(:id, "tc-ALPHAcontainer").div(:id, "ALPHAcontainer").div(:class, "tc-container-header").div(:id, "workPatternContainer").select_list(:id, "form_rotationUnit").select("Weeks") b.div(:id, "dialog-modal").frame(:id, "frModalWindow").form(:id, "timeCapture").div(:id, "tc-container").div(:id, "tc-ALPHAcontainer").div(:id, "ALPHAcontainer").div(:class, "field-container").div(:id, "timeTypeCategoryContainer").div(:class, "time-type-category").div(:class, "tc-input").select_list(:id, "form_timeTypeCategory").select 'On working' #b.div(:id, "dialog-modal").frame(:id, "frModalWindow").form(:id, "timeCapture").div(:id, "tc-container").div(:id, "tc-ALPHAcontainer").div(:id, "ALPHAcontainer").div(:class, "field-container").div(:id, "timeTypeContainer").div(:class, "tc-input").select_list(:id, "form_timeType").select("On Office-Base-Lab") # close the Browser #b.close() Thank you in advance. -- 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]
