0

I'm reading a table from a web page and one of the columns has a link in it. The table is something like this:

</div>
<div class="separator"></div>
<h1>User Management:</h1>
<table>
   <tbody>
      <tr>
         ...
      </tr>
      <tr>
         <td>[email protected]</td>
         <td>Johnny</td>
         <td><a class="pointer" onclick="deleteUs('http://localhost/..');">button1</a>
            |<a class="pointer" onclick="resetPas('http://localhost/..');">button2</a>
            |<a href="http://localhost/something/something">button3</a>
         </td>
      </tr>
      <tr>
      </tr>`

I want to click on button3(which is found in each row in this table) which gets the page redirects to the mentioned href(http://localhost/something/something) How can I do it?

3 Answers 3

1

Please try with find_element_by_partial_link_text() method.

    element = driver.find_element_by_partial_link_text('Jhonny')

Hope it helps.

Thank you .

Sign up to request clarification or add additional context in comments.

Comments

0

Here is an example to click on the link of the row having the cell "Johnny" :

driver.find_element_by_xpath("//tr[td='Johnny']//a[@href]").click()

Comments

0
select = Select(driver.find_element_by_xpath("//table//td//a[@class!='pointer']"))
select.click()

or

select = Select(driver.find_element_by_xpath("//table//td//a[3]"))
select.click()

1 Comment

because the table is dynamic I want to use the specific href. Is there another way to do this using the href?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.