1

ソースコードは次のとおりです。要素が強調表示されると、「ui-state-highlight」が class= に追加されます。

<div id="entry_1994" class="entry ui-widget-content ui-state-highlight" onfocusout="a();" onclick="if (window.bIgnoreClick===undefined) { clickHandler('entry_1994'); } else { window.bIgnoreClick=undefined; }" style="border: 1px dashed rgb(119, 119, 119);">
<script type="text/javascript">
<div id="entry_2037" class="entry ui-widget-content" onfocusout="a();" onclick="if (window.bIgnoreClick===undefined) { clickHandler('entry_2037'); } else { window.bIgnoreClick=undefined; }" style="border: 1px dashed rgb(119, 119, 119);">

これらは他にもたくさんあります。これらの要素をすべてチェックして、それらが強調表示されているかどうかを確認したい、強調表示されている場合は、これらの強調表示された要素を保存またはカウントして、数値と比較したい。

たとえば、これらの要素は 10 個あり、そのうちの 5 個が強調表示されているため、5 個を私が持っている数と比較する必要があります。これらの要素は 10 個あり、そのうちの 7 個が強調表示されているので、7 個を私が持っている数と比較する必要があります。

4

1 に答える 1

1

CSS セレクターの部分テキストによる要素の検索を調べます: http://sauceio.com/index.php/2010/01/selenium-totw-css-selectors-in-selenium-demystified/

xpath の場合: http://blog.ianbicking.org/starting-with-selenium.html

于 2012-08-21T19:33:07.837 に答える