-1

I am trying to click on this element using python-selenium bindings .There are multiple elements with the same class but different data-original-title attribute .

How can I access these elements with data-original-title="Like" directly ? instead of having to fetch first by class names then loop through elements for desired attribute .

HTML code

<div class="IconContainer js-tooltip" data-original-title="Like">

  • Are you saying elements that have a data-original-title attribute always have a unique value for it? – user3750325 Aug 01 '17 at 23:52
  • Possible duplicate of [Selenium / Python - Selecting via css selector](https://stackoverflow.com/questions/18600391/selenium-python-selecting-via-css-selector) – JeffC Aug 02 '17 at 04:32

1 Answers1

1

If you meant that the attribute data-original-title is always unique, you can select the element with the desired attribute value using xpath:

//div[@data-original-title='Like']
user3750325
  • 1,502
  • 1
  • 18
  • 37