Sebastian Nielsen Sebastian Nielsen - 25 days ago 7
Python Question

python selenium - locating a text on a website, and storing it in a variable

https://gyazo.com/9f153457558977341c95019206010e00
This is the one text I want to store in a variable from the website.
How do I do that?
This is what I came up with:

text = browser.find_elements_by_css_selector('.vip-additional-text > *:nth-child(1) > p')
print(text)


output:

[]


It returns an empty list for some reason, can anyone help me please?

Answer

If you want the text and not the webElement you should try:

text = browser.find_element_by_class_name("vip-additional-text").text