Javaを使用するwebdriverでxpathを使用してwebtableの正確な行数を取得する方法。以下のxpathを使用して、ヘッダーを使用してカウントすることもできます。カウントにヘッダー行を含めて、Webテーブルのカウントを取得したくありません。
//table[@id='ctl00_MasterPlaceHolder_GrdHistory']/tbody/tr
HTMLコード:
<table id="ctl00_MasterPlaceHolder_GrdHistory" cellspacing="2" cellpadding="0" border="0" style="color:#333333;width:100%;">
<tbody>
<tr style="color:Black;background-color:#DFC065;font-weight:bold;">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$0')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$1')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$2')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$3')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$4')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$5')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$6')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$7')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$8')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$9')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$10')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$11')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$12')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color: rgb(251, 247, 234); text-decoration: none;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$13')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color:#FBF7EA;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$14')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
<tr style="background-color:#FBF7EA;" onclick="javascript:__doPostBack('ctl00$MasterPlaceHolder$GrdHistory','Select$15')" onmouseout="javascript:setMouseOutColor(this);" onmouseover="javascript:setMouseOverColor(this);">
これは可能ですか?そうであれば、カウントにヘッダー行を含めずにカウントを取得するにはどうすればよいですか?これについて私を助けてください。ヘルプをいただければ幸いです。