-
| Problem DescriptionI'm using SeleniumBase in CDP mode and trying to get the class attribute of a parent element, but both the base element and its parent return  Code Exampledef extract_response(sb):
    """Extract the response from chat bubbles"""
    try:
        logger.info("Waiting for response bubbles")
        base_selector = 'div[data-sentry-source-file="message-header.tsx"]'
        base_element = sb.cdp.find_element(base_selector, timeout=10)
        if not base_element:
            logger.error("Base element not found!")
        parent_element = base_element.get_parent()
        print(base_element.get_attribute("class"))  # Returns: None
        print(parent_element.get_attribute("class"))  # Returns: None
        print(type(parent_element))  # Returns: <class 'seleniumbase.undetected.cdp_driver.element.Element'>Expected Behavior
 Actual Behavior
 Environment
 Any guidance on proper attribute retrieval and DOM traversal would be greatly appreciated! | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            mdmintz
          
      
      
        Oct 24, 2025 
      
    
    Replies: 1 comment
-
| Use  Since  | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        mdmintz
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Use
element.get_attribute("class_")to get theclass.Since
"class"was already a reserved identifier, you have to use"class_"instead.