0

i want to store elements in a list and click on each of them one by one. But I have to reach the < u > - Element, because .click() only works, when I click on that < u > - xpath and not on the class-Element.

<a href="javascript:doQuery(...);" class="report">
    <u>Test1</u>

<a href="javascript:doQuery(...);" class="report">
    <u>Test2</u>

<a href="javascript:doQuery(...);" class="report">
    <u>Test3</u>

Any tips? Thanks.

1
  • Your code trials? Commented Nov 14, 2020 at 18:50

1 Answer 1

1

You can use a CSS selector for this.


selector = '.report > u'

elements = driver.find_elements_by_css_selector(selector)

for elem in elements:
    elem.click()

This selector .report > u will select all <u> elements whose parent is an element with the report class.

reference

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

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.