【发布时间】:2016-04-01 20:40:12
【问题描述】:
我想用 C# 在 selenium 2 中找到一个标签,但我无法使用 id 或 xpath 等访问 div 标签。这是我的代码:
driver.FindElement(By.Id("captcha"));
网络来源是:
<body id="mainBody">
<div class="top_bar" style="min-height:210px">
<div class="m_sidebar_view">
<div id="captcha" style="position: relative; float: right; margin: 6px 35px 0 0; overflow: auto;"><div/>
</div>
</div>
</body>
【问题讨论】:
-
试试这个 xpath: " //div[@class='top_bar"]/div/div "
-
你用它做什么?
标签: c# html selenium xpath webdriver