我正在使用Python语言在selenium中为网站https://silkdb.bioinfotoolkits.net编写一些自动化脚本,在该脚本中,用户必须输入一个值,然后单击search来获取一些值是唯一的蛋白质数据。
我想点击第一行的按钮,但是按钮id和按钮名称不是常量。它们的变化取决于蛋白质名称及其数据。在这种情况下,如何使用xpath选择按钮
<tr>
<td><button id="BMSK0014734.1" class="alignment-table-description" style="border: 0px; padding: 0px; display: inline; background: none;">BMSK0014734.1 gene=BMSK0014734</button></td>
<td>327</td>
<td>327.0</td>
<td>91%</td>
<td>7e-108</td>
<td>41%</td></tr>发布于 2020-07-17 14:14:24
You can use findelements with xpath and store it to string and by using getindex you can get 1st result **//button[@class='alignment-table-description']**
List <WebElement> ele= driver.findElements(By.xpath("//button[@class='alignment-table-description']"));
ele.get(0).click();https://stackoverflow.com/questions/62948008
复制相似问题