首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过使用xpath,如何在eclipes中通过selenium打印类名

通过使用xpath,如何在eclipes中通过selenium打印类名
EN

Stack Overflow用户
提问于 2015-03-20 09:02:43
回答 1查看 1.9K关注 0票数 2

如何使用类的xpath打印类名'section__form‘。

代码语言:javascript
复制
<body>
 <div class="main">
   <div class="order-summary-recap">
       <div class="wrap">
             <div id="checkout" class="current-step-shipping_and_payment_method" data-session-storage="">
                   <div id="contact-information" class="section step step--completed">
                         <div id="shipping-method" class="section step step--current">
                             <div class="section__header">
                             <div class="section__form">
                                 <div "shipping-msg">Wait while we fetch available shipping rates…</div>
                             <div class="section__summary"> </div>
                         </div>
                   </div>
             </div>
        </div>
    </div>
 </div>   

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-20 09:16:30

您可以通过使用getAttribute:

代码语言:javascript
复制
driver.findElement(By.xpath("//div[@class='section__form']").getAttribute("class");
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29162834

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档