I am making a reddit bot that will look for certain attributes in comments, use selenium to visit the information website, and use driver.find_element_by...
to get the value inside that tag, but it is not working.
When I use driver.find_element_by_class_name()
, this is the data returned:
<selenium.webdriver.remote.webelement.WebElement (session="f454dcf92728b9db4de080a27a844bf7", element="514bd57d-99d7-4fce-a05d-3fa92f66ad49")>
when I use driver.find_elements_by_css_selector(".style-scope.ytd-video-renderer")
, this is returned:
[
<selenium.webdriver.remote.webelement.WebElement (session="43cb953cde81df270260bf769fe081a2", element="6b4ee3e2-5e6b-48e2-8ec8-9083bf15baea")>,
<selenium.webdriver.remote.webelement.WebElement (session="43cb953cde81df270260bf769fe081a2", ...
]
when I use driver.find_elements_by_css_selector(".style-scope.ytd-video-renderer")
.
Suppose that this is what I'm trying to locate (The above code returned the above Selenium data for this tag):
<yt-formatted-string class="style-scope ytd-video-renderer" aria-label="Sword Art Online: Alicization Lycoris Opening Full『ReoNa - Scar/let』 by Melodic Star 2 months ago 4 minutes, 18 seconds 837,676 views">Sword Art Online: Alicization Lycoris Opening Full『ReoNa - Scar/let』</yt-formatted-string>
What I want
I want Sword Art Online: Alicization Lycoris Opening Full『ReoNa - Scar/let』
returned.
What could I do?