M
M
majorlazer14882020-06-13 03:15:15
css
majorlazer1488, 2020-06-13 03:15:15

How to display the content of the title attribute in a css selector?

I am writing a parser in selenium and I need to display the contents of the title attribute
. Here is the code I am using

a = browser.find_element_by_css_selector('ul > li > a > span')
print(a)

Here is the code from the html page
<span class="g47SY " title="21 110">21,1тыс.</span>

If to use:
print(a.text)
I only output the text, but I need the content of the title i.e. 21 110

Answer the question

In order to leave comments, you need to log in

2 answer(s)
1
1001001, 2020-06-13
@majorlazer1488

https://selenium-python.readthedocs.io/api.html#se...

A
Aetae, 2020-06-13
@Aetae

What those need is not clear, but the text titleis in any case, like any other attribute, purely by definition.
As for the question itself, I can think of only two options:

span[title="21 093"]:after {
  content: attr(title)
}
but then what does python have to do with it? ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question