我在网页中有一些这样的内容。
Appname Description Price Part Number Validity
App1 some desc1 25 JH32 30
App2 some desc2 250 PB36 180
App2 some desc3 20 QL76 10
App3 some desc4 50 KQ3J 30
我的应用程序就像在启动应用程序后,用户将输入一个应用程序名称,selenium 将在该站点中搜索该特定应用程序名称。除了这一步,我想要的是:
无论我搜索什么应用程序名称,selenium 都必须检索与该字段对应的值,例如 selenium 应该检索价格、有效性和零件编号字段的值。我尝试 selenium 通过使用类名、标记名、id 等属性来检索值。但是所有字段对于这些字段中的每一个都具有相同的属性,这使得 selenium 在选择字段时感到困惑。
我唯一能找到的不同之处是我不能在这里使用的内部文本,因为我无法预测用户在我的应用程序开始时会在搜索框中给出什么作为应用程序名称。
我的示例 html 代码,在我单击站点中的字段(价格)后得到。我为此使用了萤火虫。我正在使用 Firefox 浏览器进行 selenium ..
<td height="100%" class="ms-vb-title"><table height="100%" cellspacing="0" surl="" uis="512" cid="0x0100DFF86ACBE51BE549AA56639FCC32D7E0" ctype="Item" ms="0" csrc="" hcd="" couid="" otype="0" icon="icgen.gif||" ext="" type="" perm="0x1b03c4312ef" dref="sites/SoftwareDev/IAG/IAS/Lists/Unify Parts" url="/sites/SoftwareDev/IAG/IAS/Lists/Unify%20Parts/27_.000" id="27" ctxname="ctx1" onmouseover="OnItem(this)" class="ms-unselectedtitle"><tbody><tr><td width="100%" class="ms-vb"><a target="_self" onclick="GoToLink(this);return false;" href="/sites/SoftwareDev/IAG/IAS/Lists/Unify%20Parts/DispForm.aspx?ID=27" onfocus="OnLink(this)">MindMeister - 251-500 Pupil License<img height="1" border="0" width="1" alt="Use SHIFT+ENTER to open the menu (new window)." class="ms-hidden" src="/_layouts/images/blank.gif"></a></td><td><img width="13" alt="" style="visibility:hidden" src="/_layouts/images/blank.gif"></td></tr></tbody></table></td>
我怎样才能实现我所说的?任何评论将不胜感激。