title: Parsing text from certain "html elements" using selenium
body: <p>What I've seen so far is that the page source of a webpage if filtered by selenium then it is possible to parse text or something necessary from that page source applying bs4 or lxml no matter the page source was javascript enabled or not. However, my question is how can I parse documents from a certain <code>html elements</code> by filtering selenium and then using bs4 or lxml library. if the below pasted element is considered then applying bs4 or lxml the way i move is:</p>
  
  <pre><code>html='''
  &lt;tr onmouseover="this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='DodgerBlue';
  this.originalcolor=this.style.color;this.style.color='White';Tip('&lt;span Style=Color:Red&gt;License: &lt;BR /&gt;20-214767 (Validity: 21/05/2022)&lt;BR /&gt;20C-214769 (Validity: 21/05/2022)&lt;BR /&gt;21-214768 (Validity: 21/05/2022)&lt;/span&gt;');" onmouseout="this.style.backgroundColor=this.originalstyle;this.style.color=this.originalcolor;UnTip();" style="background-color:White;font-family:Times New Roman;font-size:12px;"&gt;
          &lt;td style="font-size:10px;font-weight:normal;font-style:normal;text-decoration:none;" align="left"&gt;AAYUSH PHARMA&lt;/td&gt;&lt;td style="font-size:10px;font-weight:normal;font-style:normal;text-decoration:none;" align="left"&gt;PUNE-1ST FLOOR, SR.NO.742/A, DINSHOW APARTMENT,,SWAYAM HOSPITAL AND NURSING HOME, BHAWANI PETH&lt;/td&gt;&lt;td style="font-weight:normal;font-style:normal;text-decoration:none;" align="center"&gt;RH - 3&lt;/td&gt;&lt;td&gt;swapnil ramakant pawar, BPH, [140514-21/04/2017]&lt;/td&gt;
  &lt;/tr&gt;
  '''
  from bs4 import BeautifulSoup
  soup = BeautifulSoup(html,"lxml")
  #rest of the code here
  
  from lxml.html import fromstring
  tree = fromstring(html)           
  #rest of the code here
  </code></pre>
  
  <p>Now, how can I filter the above paste <code>html</code> portion using selenium and then apply bs4 library on it? Could not think of <code>driver.page_source</code> as it is only applicable when filtered from a webpage.</p>
  
  <p>To be a little more specific, if I want to use something like below, then how can it be?</p>
  
  <pre><code>from selenium import webdriver
  driver = webdriver.Chrome()
  
  element_html = driver-------(html)  #this "html" is the above pasted one
  print(element_html)
  </code></pre>