0

I have text already scrapped into a list A=[' Workers east', ' Worker united']. What I'm trying to do is from A, find in the browser the words Worker united and click on it, I'm trying this:

driver.find_element_by_partial_link_text("%s" %(A[1])).click()

But is not working, it doesn´t find the element. Below is the HTML Code and working with:

<ul style="display: block;">
    <li class="">
        <a class="text  active" href="/es/news/UK/London/workers-united---team">
            Workers United - Team
            <div style="top: -1.5px;" class="marker"></div>
        </a>
    </li>

I will appreciate any help you could give me, thanks!

1
  • The error I've got is this: selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"partial link text","selector":" Workers United"} Commented Feb 22, 2016 at 1:13

3 Answers 3

3

The element you have has Workers United - Team inside the text, but you are searching for Worker united - watch the s and the case.

Also, remove the leading spaces in the strings inside the A list.

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

Comments

3

The text you are looking for is:

Worker united

The text that exists on the page is:

Workers United

Selenium is case sensitive. Capitalize the u in your python script

Additionally, as pointed out by @alecxe, your pluralization for worker is incorrect. The page displays "workers" (plural)

Comments

0

You can use XPATH: //a[contains(text(), 'Worker')]

Comments

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.