2014-11-19 2 views
0

Watir에 대해 배우려고하므로 나와 함께 견뎌주십시오. 여러 드롭 다운 옵션 (크기, 색상, 구성)이있는 웹 사이트에 제품이 있습니다. 모든 드롭 다운 옵션을 선택하기 전까지 코드 블록을 반복해야 항목을 장바구니에 추가 할 수 있습니다.결과 목록의 제품에 대한 모든 드롭 다운에서 옵션 선택

첫 번째 드롭 다운 상자를 클릭하면 옵션이 성공적으로 선택됩니다. 두 번째 드롭 다운 상자를 클릭했지만 각 드롭 다운에서 동일한 HTML이 사용 되더라도 요소 (옵션)를 찾을 수 없다는 오류가 표시됩니다. 누군가 나를 선택할 수있는 드롭 다운 옵션을 추가로 얻는 방법을 알아낼 수 있습니까? 여기

내 루비 코드 :

skuString = @browser.button(:text, 'Add To Cart').id 
sku = skuString[/[^_]+/] 
skuOptions = hapi.getProduct(sku) 
numOfOptions = skuOptions['products'][0]['options'].size 

numOfOptions.times do |n| 
@browser.spans(:class, 'HN-Item-Opt-Ar bg-hn-background icon-down-open')[n].when_present.click 

if @browser.div(:class, 'standard-style HN-Item-Opt relativePosition ng-scope').exists? 
    @browser.div(:class, 'standard-style HN-Item-Opt relativePosition ng-scope').when_present.click 
else @browser.div(:class, 'standard-style padding10px HN-Item-Opt clearfix ng-scope').when_present.click 
end 
end 

그리고 여기에 오류가 나는 아래로 두 번째 드롭에받을 수있다 :

<div class="paddingSides15px paddingTopOnly5px borderTop border-hn-secondary-lt"> 

    <div hn-product-options="" options="model.product.options" variation="model.product.variation" productid="model.product.productID" class="ng-scope"> 

      <div hn-product-option="" ng-class="{'option-invalid': !option.valueSelected}" option="options[0]" class="ng-scope option-invalid"> 
       <div hn-select="" label="Bed Size (2)" select-name=" - Bed Size" on-collapse="getValueData(args)" class="marginTopOnly10px hn-option ng-isolate-scope" hn-input-disable="" hn-input-disable-exclude="lastSelectedOption == option" enable-on="hnProductOptions:updateComplete" disable-on="hnProductOptions:updating" content-width="654"><div class="HN-Select-Option"> 
<div ng-click="toggleContent()" style="height:100%;overflow: hidden;" class=""> 
    <div class="standard-style text-small noWrap"> 
     <div class="HN-Opt-Lbl noWrap inline-block ng-binding" hn-bind-html="displayData">Bed Size (2)</div> 
     <div swatch-preview="" class="inline-block swatch-preview-cont ng-scope" style="width: 0px;"> 
      <!-- ngRepeat: img in swatches.images --> 
     </div> 
    </div> 
    <span class="HN-Item-Opt-Ar bg-hn-background icon-down-open"></span> 
</div> 

<div class="form-error text-small ng-binding ng-hide" ng-show="hasCustomErrorCondition ? errorCondition() : (data.isCustomKitOption ? (dirty &amp;&amp; !data.valid &amp;&amp; !data.isPristine) : displayError)"> 
    Please Select<br> 
    Your - Bed Size 
</div> 
<div ng-transclude="" class="hn-select-content" ng-class="{'open-to-left':openToLeft, 'expand-to-left':expandToLeft}"> 

        <ul hn-select-scroller="" scroll-lock="" ng-mouseleave="hideLargeSwatch()" ng-class="{'grid':option.isGridView}" class="whiteBackground border border-hn-secondary-lt text-small ng-scope ng-isolate-scope"> 

          <div ng-show="option.selectedValue.optionValueID !== undefined" class="ng-hide"> 
           <div hn-select-attr-clear="" on-option-select="clearSelected()" class="hn-select-attr-clear standard-style padding10px HN-Item-Opt borderBottom border-hn-secondary-lt hover-active ng-isolate-scope"> 
            <span class="icon-cancel" style="width: auto;"></span> 
            &nbsp;<span class="clear-selection">Clear Selection</span> 
           </div> 
          </div> 

         <!-- ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Full</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $370.00<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $1,729.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Queen</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $390.00<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $1,749.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --> 
        </ul> 
        <!-- ngIf: option.imgExists || !isAvailable --> 
       </div> 
</div></div> 

      </div> 

      <div hn-product-option="" ng-class="{'option-invalid': !option.valueSelected}" option="options[1]" class="ng-scope option-invalid"> 
       <div hn-select="" label="Configuration (9)" select-name=" - Configuration" on-collapse="getValueData(args)" class="marginTopOnly10px hn-option ng-isolate-scope" hn-input-disable="" hn-input-disable-exclude="lastSelectedOption == option" enable-on="hnProductOptions:updateComplete" disable-on="hnProductOptions:updating" content-width="654"><div class="HN-Select-Option"> 
<div ng-click="toggleContent()" style="height:100%;overflow: hidden;"> 
    <div class="standard-style text-small noWrap"> 
     <div class="HN-Opt-Lbl noWrap inline-block ng-binding" hn-bind-html="displayData">Configuration (9)</div> 
     <div swatch-preview="" class="inline-block swatch-preview-cont ng-scope" style="width: 0px;"> 
      <!-- ngRepeat: img in swatches.images --> 
     </div> 
    </div> 
    <span class="HN-Item-Opt-Ar bg-hn-background icon-down-open"></span> 
</div> 

<div class="form-error text-small ng-binding ng-hide" ng-show="hasCustomErrorCondition ? errorCondition() : (data.isCustomKitOption ? (dirty &amp;&amp; !data.valid &amp;&amp; !data.isPristine) : displayError)"> 
    Please Select<br> 
    Your - Configuration 
</div> 
<div ng-transclude="" class="hn-select-content" ng-class="{'open-to-left':openToLeft, 'expand-to-left':expandToLeft}"> 

        <ul hn-select-scroller="" scroll-lock="" ng-mouseleave="hideLargeSwatch()" ng-class="{'grid':option.isGridView}" class="whiteBackground border border-hn-secondary-lt text-small ng-scope ng-isolate-scope"> 

          <div ng-show="option.selectedValue.optionValueID !== undefined" class="ng-hide"> 
           <div hn-select-attr-clear="" on-option-select="clearSelected()" class="hn-select-attr-clear standard-style padding10px HN-Item-Opt borderBottom border-hn-secondary-lt hover-active ng-isolate-scope"> 
            <span class="icon-cancel" style="width: auto;"></span> 
            &nbsp;<span class="clear-selection">Clear Selection</span> 
           </div> 
          </div> 

         <!-- ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Bed Only</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $370.00<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $390.00</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Bed + Nightstand</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $569.99<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $589.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Bed + 2 Nightstands</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $759.99<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $779.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Bed + Dresser + MIrror</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $869.99<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $889.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Bed + Chest</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $829.99<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $849.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Bed + Nightstand + Dresser + Mirror</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $1,069.99<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $1,089.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Bed + Nightstand + Chest</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $1,029.99<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $1,049.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Bed + Nightstand + Dresser + Mirror + Chest</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $1,529.99<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $1,549.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --><li hn-product-option-value="" item="optionData" ng-repeat="optionData in option.values" ng-class="{grid:option.isGridView}" class="ng-scope"> 
          <div hn-select-attr="" option="item" on-option-select="selectValue()" on-hover="getValueData(args)" grid="option.isGridView" ng-class="{'borderBottom border-hn-secondary-lt':(!option.isGridView), grid:(option.isGridView)}" class="ng-isolate-scope hover-active borderBottom border-hn-secondary-lt"><div lazy-load-html="getTemplate()"><div ng-click="selectThis($event)" class="standard-style padding10px HN-Item-Opt clearfix ng-scope" ng-class="{'HN-Item-Opt-Sel':optionData.data.selectedFlag,'opt-deactive':!optionData.data.availableFlag, 'touch-hover':onHover().thisValue ==optionData.value}"> 
<!-- ngIf: option.optionImgExists && !option.swatchImgExists --> 
<!-- ngIf: option.swatchImgExists --> 
<span class="text-small HN-Item-Opt-Name ng-binding" hn-bind-html="optionData.data.text || optionData.data.name" hn-bind-html-filter="boolToCF">Bed + 2 Nightstands + Dresser + Mirror + Chest</span><br> 
<!-- ngIf: optionData.data.availableFlag && option.isPriceRangeSku --><span ng-if="optionData.data.availableFlag &amp;&amp; option.isPriceRangeSku" class="text-tiny text-hn-red ng-scope"> 
    <span ng-switch="option.isCustomKitOption"> 
     <!-- ngSwitchWhen: true --> 
     <!-- ngSwitchDefault: --><span ng-switch-default="" class="ng-scope ng-binding"> 
      $1,729.99<!-- ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --><span ng-if="optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice" class="ng-scope ng-binding"> - $1,749.99</span><!-- end ngIf: optionData.data.minDisplayPrice !== optionData.data.maxDisplayPrice --> 
     </span> 
    </span> 
</span><!-- end ngIf: optionData.data.availableFlag && option.isPriceRangeSku --> 
<!-- ngIf: !optionData.data.availableFlag --> 
</div></div></div> 
         </li><!-- end ngRepeat: optionData in option.values --> 
        </ul> 
        <!-- ngIf: option.imgExists || !isAvailable --> 
       </div> 
</div></div> 

      </div> 

    </div> 

</div> 
다음은
Watir::Wait::TimeoutError: timed out after 90 seconds, waiting for {:class=>"standard-style padding10px HN-Item-Opt clearfix ng-scope", :tag_name=>"div"} to become present 
./features/step_definitions/result_lists.rb:41:in `block (2 levels) in <top (required)>' 
./features/step_definitions/result_lists.rb:32:in `times' 
./features/step_definitions/result_lists.rb:32:in `/^I select options in the modal$/' 

이 옵션 섹션의 HTML입니다
+0

페이지의 HTML을 공유 할 수 있습니까? –

+0

얼마나 많은 HTML이 필요합니까? 전체 큰 덩어리? – user3415796

+0

문제를 재현 할 수있을 정도로 충분합니다. 아이디어는 응답의 임의 추측을 제거 (또는 적어도 줄이기)를 원한다는 것입니다. –

답변

1

문제는 줄에 있습니다 :

@browser.div(:class, 'standard-style padding10px HN-Item-Opt clearfix ng-scope').when_present.click 

HTML에서이 div가 처음 나타나는 것을 기다리고 있습니다. 즉, 항상 "전체"침대 옵션이 나타나기를 기다리고 있습니다. 이는 침대 유형을 업데이트 할 때 작동하지만 구성 유형을 업데이트 할 때는 나타나지 않습니다.

해당 항목에 대한 검사 범위를 지정해야합니다. 이를 수행하는 데는 여러 가지 방법이 있습니다. 그러나 최소한의 변경을 요구하는 접근 방식은 클래스 "hn-select-content"를 사용하여 div를 사용하는 것 같습니다. 드롭 다운마다 한 번 나타납니다.

numOfOptions.times do |n| 
    @browser.spans(:class, 'HN-Item-Opt-Ar bg-hn-background icon-down-open')[n].when_present.click 

    if @browser.div(:class, 'standard-style HN-Item-Opt relativePosition ng-scope').exists? 
    @browser.div(:class, 'standard-style HN-Item-Opt relativePosition ng-scope').when_present.click 
    else 
    list = @browser.div(:class => 'hn-select-content', :index => n) 
    list.div(:class, 'standard-style padding10px HN-Item-Opt clearfix ng-scope').when_present.click 
    end 
end 
+0

매력처럼 작동했습니다. 너무 고마워요! – user3415796

관련 문제