<!DOCTYPE html>
<html>
<head>
<title>Sample Crawl</title>
</head>
<body>
<div class="software">
<h3>Company 1</h3>
<p>Google</p>
</div>
<div class="software">
<h3>Company 2</h3>
<p>Facebook</p>
</div>
<div class="software">
<h3>Company 3</h3>
<p>Github</p>
</div>
<div class="software">
<h3>Company 4</h3>
<p>Yahoo</p>
</div>
</body>
</html>
下面我编写了获取单个div标签内容的代码
driver.find_element(:xpath => "//div[@class='software']/h3").text
driver.find_element(:xpath => "//div[@class='software']/p").text
但是我无法遍历具有相同class =“software”的每个div标签