Extract a href in a p element with Selenium

Hi, I’m very new in selenium use.
I 've this html script part of the page I’m scraping.

<div class = "text">
 <div id ="eventlogger">
    "This is your relative"
   <a target="_blank" href="/usr/xxxxxxxxx">yyyyyyy</a>

Now I need to extract “yyyyyyyyy” for many follow if conditions in my script.
I think I need to use


but I don’t know how.
Can someone please help me?

In a script I have these defined on a base class:

    def findById( self, elem_id ):
        return self.driver.find_element_by_id( elem_id )

    def findAllByClass( self, class_name ):
        return self.driver.find_elements( By.CLASS_NAME, class_name )

    def findAllByName( self, name ):
        return self.driver.find_elements( By.NAME, name )

    def findAllByTagName( self, name ):
        return self.driver.find_elements_by_tag_name( name )

    def findByLinkText( self, text ):
        return self.driver.find_element_by_link_text( text )

Once you zero in on the element. You can use on find_element() on the found elements are well.

I think in your case you would do something like:

div = self.driver.find_element_by_id( "eventlogger" )
all_a = div.find_element_by_tag_name( "a" )
a = all_a[0]
print(a.text) # this should be the yyyyyy

Thankyou @barry-scott .
I tried with your code but it returned me

div = self.driver.find_element_by_id(“eventlogger”)
AttributeError: module ‘self’ has no attribute ‘driver’

I also tried with

div = driver.find_element(By.ID, "eventlogger")
    all_a = div.find_element(By.TAG_NAME, "a")
    a = all_a[0]

but it give me

Message: no such element: Unable to locate element: {“method”:“tag name”,“selector”:“a”}

That is code you need to adapt. Not literally run!

You have do the selenium code that browse to the url the write code based on my code fragments.

Thanks @barry-scott