【发布时间】:2019-07-21 22:24:00
【问题描述】:
我无法在我的网站中找到标签元素。下面是tab元素的html代码:
<a class="tab-button has-title has-icon" href="#" role="tab" id="tab-t0-2" aria-controls="tabpanel-t0-2" aria-selected="true">
<custom-icon class="mmi-tabbar-tpr tab-button-icon"></custom-icon>
<!---->
<!----><span class="tab-button-text">TPR</span>
<!---->
<div class="button-effect" style="transform: translate3d(-14px, -17px, 0px) scale(1); height: 103px; width: 103px; opacity: 0; transition: transform 313ms, opacity 219ms 94ms;"></div>
</a>
它也不在任何 iframe 中。我尝试复制它的 xpath //*[@id="tab-t0-2"],但没有运气。任何帮助都将不胜感激。
记录的错误:
线程“主”org.openqa.selenium.NoSuchElementException 中的异常: 没有这样的元素:无法找到元素: {"method":"xpath","selector":"//a[@id='tab-t0-2']"} (会话信息: chrome=61.0.3163.100)(驱动程序信息:chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),平台=Windows NT 6.1.7601 SP1 x86_64)(警告:服务器未提供任何堆栈跟踪信息)
【问题讨论】:
-
什么是错误/异常?
-
线程“main”中的异常 org.openqa.selenium.NoSuchElementException:没有这样的元素:无法找到元素:{“method”:“xpath”,“selector”:“//a [@ id='tab-t0-2']"}(会话信息:chrome=61.0.3163.100)(驱动程序信息:chromedriver=2.34.522940(1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),平台=Windows NT 6.1.7601 SP1 x86_64)(警告:服务器没有提供任何堆栈跟踪信息)
标签: selenium selenium-webdriver