擅长:python、mysql、java
<p>要获得特定的按钮,可以尝试使用class和index,也可以尝试使用text和index</p>
<pre><code>driver.find_element_by_xpath("(//button[text()[contains(.,'Attack')]])[indexval]")
driver.find_element_by_xpath("(//button[@class='expedition_button awesome-button '])[indexval]")
</code></pre>
<p>对于按钮1:</p>
<pre><code>driver.find_element_by_xpath("(//button[text()[contains(.,'Attack')]])[1]")
</code></pre>
<p>或者</p>
<pre><code>driver.find_element_by_xpath("(//button[@class='expedition_button awesome-button '])[1]")
</code></pre>
<p>按钮2、3和;4只需增加索引值</p>