简体   繁体   中英

Entering text into a UI-grid using watir automation

We have recently changed from ng-grid to Ui-grid. This has broken lots of my automation scripts.

Currently I am having trouble entering text into a textbox.

My HTML:

<div 
  class="ui-grid-cell ng-scope ui-grid-coluiGrid-0005" 
  ui-grid-cell=""
  ng-class="{
    'ui-grid-row-header-cell': col.isRowHeader,
    'rowError': row.entity.isValid != undefined && !row.entity.isValid }" 
  ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" 
  tabindex="-1"
  aria-selected="true">

    <div 
      class="ui-grid-cell-contents
      ng-binding ng-scope
      ui-grid-cell-focus">
    </div>
</div>

So I tried this, but with no joy:

@browser.textarea(:class,'ui-grid-cell-contents ng-binding ng-scope ui-grid-cell-focus').when_present.set 'test'

Finally figured it out, so the following does what i want it to:

@browser.div(:xpath,'html/body/div[1]/div[3]/div/div/div/div/div/form/div/div/div[3]/div/div[1]/div[2]/div[1]/div[2]/div/div/div/div[1]/div').when_present.click
@browser.text_field(:index,1).when_present.set 'Field 1'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM