【发布时间】:2019-03-29 11:33:41
【问题描述】:
这是我要自动化的网页的网址:
http://www.qaclickacademy.com/courses-description.php
我想使用 Selenium 和 XPath 定位器获取非删除线价格(当前为 20.00 美元)的值。
包含我感兴趣的元素的 HTML 标记的 sn-p 是:
<div class="course row" data-scroll-reveal=""
style="-webkit-transform: translatey(24px);transform: translatey(24px);opacity: 0;-webkit-transition: -webkit-transform 0.66s ease-in-out 0s, opacity 0.66s ease-in-out 0s;transition: transform 0.66s ease-in-out 0s, opacity 0.66s ease-in-out 0s;-webkit-perspective: 1000;-webkit-backface-visibility: hidden;"
data-scroll-reveal-initialized="true">
<div class="col-sm-4">
<a href="course-detail.php?id=130&t=websecurity-testing-for-beginners-qa-knowledge-to-next-level">
<img src="/courses-description.php?show=130" alt="websecurity-testing-for-beginners-qa-knowledge-to-next-level" class="img-responsive" width="186" height="123">
</a>
</div>
<div class="col-sm-8">
<div class="row">
<div class="col-md-9 col-sm-8">
<h3>
<a href="course-detail.php?id=130&t=websecurity-testing-for-beginners-qa-knowledge-to-next-level">
WebSecurity Testing for Beginners-QA knowledge to next level
</a>
</h3>
<div class="meta">
<span><i class="fa fa-user"></i><a href="#">Rahul Shetty</a></span>
<span><i class="fa fa-file-text"></i>60 Lessons</span>
<span><i class="fa fa-folder"></i><a href="#">Penetration testing</a></span>
</div>
</div>
<div class="col-md-3 col-sm-4 price">
<del style="font-size:15px;color:#aaa">$ 85.00</del>
<br>
$ 20.00
</div>
</div>
<div class="row">
<div class="col-sm-12">
<p class="course-desc">
Course Launch Date : Aug 30th 2015 -Its Time to Protect our Websites from Security Attacks This Tutorial will give all the weapons you needed to investigate and
unlock the Security Holes in the Web applicationCourse lectures are conceptually driven with root level explanations and bring you to the level where you can
bring out the security bugsCourse Contents: Basics of Security Testing...
<br>
<a href="course-detail.php?id=130&t=websecurity-testing-for-beginners-qa-knowledge-to-next-level">
Read More
<i class="fa fa-angle-right"></i>
</a>
</p>
</div>
</div>
</div>
<div class="col-md-12">
<hr>
</div>
</div>
我尝试了很多方法,但到目前为止我一直无法找到解决方案
【问题讨论】:
-
试试这个它会起作用 //del[contains(text(),'$ 85.00')]
-
输出应该是“$ 20.00”。价格是动态的。它会经常改变......
-
哪一个,有4个
-
首个产品价格“$20.00”
-
您使用哪种语言绑定? Java/Python?
标签: javascript selenium xpath webdriverwait xpath-1.0