0

I am doing some automation script for the website https://silkdb.bioinfotoolkits.net in selenium using python language in which one has to enter a value and click on search that fetches some protein data whose values are unique.

I would like to click the button in the first row but the button id and button name were ot constant. they change depennding upon the protein name and its data. I such case how can i select the button using xpath

picture is shown here

<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>
zealous
  • 7,336
  • 4
  • 16
  • 36
  • I'd suggest you to go through the answers provided within your [previous question](https://stackoverflow.com/questions/62936325/how-to-click-an-input-role-as-radio-located-under-in-selenium-using-python). Conceptually, the answer to this question is similar to the previous oneand should help you out. – undetected Selenium Jul 17 '20 at 08:09

1 Answers1

0
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();
Justin Lambert
  • 940
  • 1
  • 7
  • 13
  • I am doing it in python language. can u explain it in python – Srinu Javadhi Jul 17 '20 at 06:16
  • Hey here i am using findelements in selenium by List class in selenium can you try with https://stackoverflow.com/questions/31496322/selenium-python-using-find-elements-how-do-i-get-the-text-value-of-each-element i think programming language is not matter for this, only thing is selenium – Justin Lambert Jul 17 '20 at 06:21