ruby - Select textarea by using the class and ID with Watir-WebDriver -
trying figure out how select field on form using textarea specifying class , id. unfortunately, don't have control on html generated vendor product.
sample html:
<textarea class="text sr " id="arid_win_0_636875000" style="left: 402px; top: 0px; width: 261px; height: 21px;" rows="1" cols="20" wrap="off" arautoctt="400" arautocak="0" maxlen="255"></textarea> i need use both id , class because id used in multiple spots class, however, have found combination of 2 unique.
i've tried doing:
z = textarea(:class => "text sr ", :id => "arid_win_0_636875000") this came with:
=> #<watir::textarea:0x272de17c located=false sel >"arid_win_0_636875000", :tag_name=>"textarea"}> tried setting , came with:
watir::exception::unknownobjectexception: unable locate element, using {:class=>"text sr ", :id=>"arid_win_0_636875000", :tag_name=>"textarea"} c:/ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/elements/element.rb:507:in `assert_exists' c:/ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/user_editable.rb:32:in `clear' c:/ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/user_editable.rb:11:in `set' (irb):21:in `block in irb_binding' c:/ruby21/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/common/target_locator.rb:50:in `window' c:/ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/window.rb:193:in `use' (irb):20 c:/ruby21/bin/irb:11:in `<main>' this html popup:
<div class="divpopup shadow " id="popup_0" style="left: 495px; top: 161.5px; width: 930px; height: 673px; overflow: hidden; visibility: inherit; z-index: 100004;" arwindowid="0"><table class="divpopup resizablepopup" id="divtable" cellspacing="0" cellpadding="0"><tbody><tr class="divpopuptitlebar divdraggable"><td class="topleft"> </td><td align="left" class="center" id="title_0" nowrap=""><div class="title">name of form here </div><button title="close" class="close right" id="ardivpcl" onclick="var target=findclickedpopup('0', event); if(target){ target.oncancel();target.stopbubbling(event);return false;}" type="button"></button></td><td class="topright"> </td></tr><tr><td class="divpopupbodynoborder divpopupbodyborder" colspan="3"><iframe id="1433419427651p" src="/arsys/forms/vmpit-ermdy006/nameofformishere/administrator/?cacheid=fa90df9&format=html" frameborder="0" style="width: 100%; height: 652px;"></iframe></td></tr></tbody></table><b class="rndfooter" style="background-color: rgb(255, 255, 255);"><b class="rnd1" style="background-color: rgb(255, 255, 255);"></b><b class="rnd2" style="background-color: rgb(255, 255, 255);"></b><b class="rnd3"></b></b><div class="resizehandle right" id="handle_0"></div></div>
given html popup, guess div element within original page rather own browser window. accessing popup should with:
browser.div(:id => "popup_0") that said, not see textarea in it, means in iframe element. iframes have explicitly told watir, means find textarea need:
browser.div(:id => "popup_0").iframe.textarea(:class => "text sr ", :id => "arid_win_0_636875000")
Comments
Post a Comment