以下のHTML表の列のソート順を確認する必要があります。完全なHTMLページでは、列ヘッダーをクリックしてascとdescをソートすることができます。テーブル内のデータは動的なので、テストの開始前にハードコードされた値を格納するだけで、そこに何があるのかを常に知ることはできません。Selenium Webdriverを使用してInfragisticsグリッドの列のソート順を確認する方法
私はC#とSeleniumの初心者ですので、HTMLテーブルのソート順を確認する方法はわかりません。私のテストには、ソートの検証まですべてが含まれています。私はすでにページ/テーブルに移動するためのコードを用意しており、列見出しの1つをクリックするコードも用意しています。しかし、クリックした列が実際にクリック後に昇順にソートされたことを確認する方法をどこから始めるべきかわかりません。
おそらく2つの文字列配列変数を格納する必要があることは知っています。 1の配列をクリックした後のリストとして表示します。それから私はリストを取って、何らかのC#クラスを使ってソートします。次に比較を行います。しかし、私はちょうどC#を学んでいるので、誰かがセレンとC#を使ってこれを達成する方法について私を助けることができます。
私は達成するために必要なもの(http://grokbase.com/t/gg/selenium-users/125g89zssv/selenium-webdriver-how-to-verify-whether-list-containing-rows-from-a-table-is-sorted)と似たものを見つけましたが、それはJavaで記述されていると思います。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" data-bind="igGrid: gridOptions" id="ap-orgconfig-orgs" aria-multiselectable="false" role="grid" class="ui-iggrid-table ui-widget-content" aria-describedby="ap-orgconfig-orgs_container" style="table-layout: fixed; overflow: hidden;">
<colgroup>
<col style="width: 50%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead role="rowgroup">
<tr role="row" data-header-row="">
<th id="ap-orgconfig-orgs_Name" role="columnheader" aria-label="Name" tabindex="0" class="ui-iggrid-header ui-widget-header ui-iggrid-sortableheader ui-state-default" title="Sort column">
<div data-resizinghandle="true" style="position: relative; width: 100%; height: 0px; top: 0px; left: 0px;">
<a title="">
<span data-nonpaddedindicator="right" title="" style="position: absolute; margin-right: -6px; right: 0px; width: 5px;" class="ui-iggrid-resizing-handle-cursor ui-iggrid-resizing-handle">
</span></a>
</div>
<span class="ui-iggrid-headertext">Name
</span>
<span class="ui-iggrid-colindicator">
</span>
</th>
<th id="ap-orgconfig-orgs_ShortName" role="columnheader" aria-label="Display Name" tabindex="0" class="ui-iggrid-header ui-widget-header ui-iggrid-sortableheader ui-state-default" title="Sort column">
<div data-resizinghandle="true" style="position: relative; width: 100%; height: 0px; top: 0px; left: 0px;">
<a title="">
<span data-nonpaddedindicator="right" title="" style="position: absolute; margin-right: -6px; right: 0px; width: 5px;" class="ui-iggrid-resizing-handle-cursor ui-iggrid-resizing-handle">
</span></a>
</div>
<span class="ui-iggrid-headertext">Display Name
</span>
<span class="ui-iggrid-colindicator">
</span>
</th>
<th id="ap-orgconfig-orgs_Type" role="columnheader" aria-label="Type" tabindex="0" class="ui-iggrid-header ui-widget-header ui-iggrid-sortableheader ui-state-default" title="Sort column">
<div data-resizinghandle="true" style="position: relative; width: 100%; height: 0px; top: 0px; left: 0px;">
<a title="">
<span data-nonpaddedindicator="right" title="" style="position: absolute; margin-right: -6px; right: 0px; width: 5px;" class="ui-iggrid-resizing-handle-cursor ui-iggrid-resizing-handle">
</span></a>
</div>
<span class="ui-iggrid-headertext">Type
</span>
<span class="ui-iggrid-colindicator">
</span>
</th>
</tr>
</thead>
<tbody role="rowgroup" class="ui-widget-content ui-iggrid-tablebody ui-ig-record ui-iggrid-record">
<tr tabindex="0" role="row" data-id="05f1e963-5a94-47d0-b9c0-3019906d0b25">
<td tabindex="0" aria-describedby="ap-orgconfig-orgs_Name" aria-readonly="false" role="gridcell" class="">QA Test Organization</td>
<td tabindex="0" aria-describedby="ap-orgconfig-orgs_ShortName" aria-readonly="false" role="gridcell" class="">QA-ORG</td>
<td tabindex="0" aria-describedby="ap-orgconfig-orgs_Type" aria-readonly="false" role="gridcell" class="">Consumer</td>
</tr>
<tr tabindex="0" role="row" data-id="bb0d84aa-856b-4b89-a380-63bca7a0133f" class="ui-ig-altrecord ui-iggrid-altrecord">
<td tabindex="0" aria-describedby="ap-orgconfig-orgs_Name" aria-readonly="false" role="gridcell" class="">The CIA Network </td>
<td tabindex="0" aria-describedby="ap-orgconfig-orgs_ShortName" aria-readonly="false" role="gridcell" class="">CIANyde</td>
<td tabindex="0" aria-describedby="ap-orgconfig-orgs_Type" aria-readonly="false" role="gridcell" class="">Network</td>
</tr>
<tr tabindex="0" role="row" data-id="fb311950-5aa2-4124-b69c-026d47e94e73" class="" aria-selected="true">
<td tabindex="0" aria-describedby="ap-orgconfig-orgs_Name" aria-readonly="false" role="gridcell" class="ui-iggrid-selectedcell ui-state-active">The Mockingbird Network</td>
<td tabindex="0" aria-describedby="ap-orgconfig-orgs_ShortName" aria-readonly="false" role="gridcell" class="ui-iggrid-selectedcell ui-state-active">AgitProp</td>
<td tabindex="0" aria-describedby="ap-orgconfig-orgs_Type" aria-readonly="false" role="gridcell" class="ui-iggrid-selectedcell ui-state-active">Network</td>
</tr>
</tbody>
<tfoot class="" role="rowgroup" id="ap-orgconfig-orgs_footer_container" style="display: none;">
</tfoot>
</table>
</body>
</html>
UIの列で並べ替えると、DOM内のセルまたは行要素が使用されますか? –