How to get all xml/dom as text under a parent web element using selenium/python?

How to get all xml/dom as text under a parent web element using selenium/python?

I have a scenario that requires working on a UI object displayed as a grid but the rows and columns are separate web elements contained in the xml / dom hierarchy consisting of multiple xpaths that can be parsed using a common pattern. All these elements contain texts corresponding to the column type. Getting all these texts by webelement references one by one takes time. Is there a way to get all this xml as text (or for at least one row in a single shot) to save extraction time by parsing entire xml inline.

I have a scenario that requires working on a UI object displayed as a grid but the rows and columns are separate web elements contained in the xml / dom hierarchy consisting of multiple xpaths that can be parsed using a common pattern. All these elements contain texts corresponding to the column type. Getting all these texts by webelement references one by one takes time. Is there a way to get all this xml as text (or for at least one row in a single shot) to save extraction time by parsing entire xml inline.

For example, consider the bottom mentioned xml. How can i get all xml hierarchy underneath <div[@class='table']> as text to parse or even for entire first row in the table.

<div[@class='table']>
         <div[@class='rows']>
              <div[@class='row']>[0]:

This is the sample example:

<div[@class='table']>
     <div[@class='rows']>
          <div[@class='row']>
               <div[@class='col']>
                   <div[@class='element']>some_text1</div[@class='element']>
                   <div[@class='element']>some_text2</div[@class='element']>
                   <div[@class='element']>some_text3</div[@class='element']>
                   ...
               </div[@class='col']>
          </div[@class='row']>
          <div[@class='row']>
               <div[@class='col']>
                   <div[@class='element']>some_text1</div[@class='element']>
                   <div[@class='element']>some_text2</div[@class='element']>
                   <div[@class='element']>some_text3</div[@class='element']>
                   ...
               </div[@class='col']>
          </div[@class='row']>
          <div[@class='row']>
               ...
          </div[@class='row']>
          <div[@class='row']>
               ...
          </div[@class='row']>
          <div[@class='row']>
               ...
          </div[@class='row']>
     </div[@class='rows']>
</div[@class='table']>


python selenium

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Python Selenium Introduction & Installation

This is our first article with video training on Python Selenium, in this article we are going to talk about Introduction & Installation of Selenium. we are

Python Selenium Web Elements Introduction

This is our second article on Python Selenium, in this article we are going to learn about Web Elements Introduction in Python Selenium. in the first

Python Selenium Web Driver Navigation Command

Python Selenium Web Driver Navigation Command - In this article we are going to learn about Selenium Web Driver Navigation Command in Python.so using Selenium

Selenium with Python

Selenium with Python

Basic Data Types in Python | Python Web Development For Beginners

In the programming world, Data types play an important role. Each Variable is stored in different data types and responsible for various functions. Python had two different objects, and They are mutable and immutable objects.