【发布时间】:2017-05-20 12:09:23
【问题描述】:
我正在尝试在 Selenium 中识别一个链接(链接文本是“Pearson eText”)。我尝试过使用 By.linkText、By.xpath 甚至 By.tagName,但这些似乎都不起作用。我想知道是否有人可以让我知道是否有更多方法可以识别元素。以下是网页中的 html 代码。提前致谢!
<div class="container_12" style="margin-bottom:10px;">
<div class="grid_5" id="studlinks"><h3><a href="javascript:launch('71053')">Welcome to MasteringAandP</a></h3><p>Access all your Mastering course resources and assignments
</p><h3><a href="javascript:launch('164')">Mastering Assignments</a></h3><p>Access Mastering homework assignments.</p><h3><a href="javascript:launch('165')">Mastering Scores (for students)</a></h3><p>Access your results for all Mastering work you have completed. </p><h3><a href="javascript:launch('170')">User Settings</a></h3><p>Manage your Pearson account information.</p><h3><a href="javascript:launch('171')">Pearson eText</a></h3><p>Access your Pearson eText.</p><h3><a href="javascript:launch('172')">Study Area</a></h3><p>Access the self Study Area to watch videos and animations, take practice quizzes and more. Your work in the Study Area does not report to your instructor's grade book. To complete instructor-assigned activities, go to Assignments.</p><h3><a href="javascript:launch('105')">MasteringAandP Course Home</a></h3><p>Access your MasteringAandP course for additional content and assignments.</p></div>
<div class="grid_5" id="instlinks"></div>
</div>
【问题讨论】:
-
当您通过链接文本进行搜索时,您是使用
"Access your Pearson eText"还是仅使用"Pearson eText"?