0

How do you take the text "BURGUNDY" from the HTML code:

<div class = "row"><div class = "col-md-12"></div>BURGUNDY</div>

<div class = "row"><div class = "col-md-12"></div>randomTxt</div>

I can't figure it out, please help me by using Python or Selenium. Thank You

Fity
  • 11
  • 2
  • Can you share the actual content of div as per your scraped data. Ideally using `div.text` you should be able to get the text content from any div element. Additional Information might help. – Eswar Chitirala Aug 30 '20 at 04:03

1 Answers1

0

First I don't know how much you familiar with selenium testing, I assume you have configured chrome driver or any web driver properly.

As I understand you want to read the inner content of a div tag.

With some easy steps, you can do that.

  1. Get the element by id, class or XPath(you can find this using dev tools of the browser)
  2. From that element, you can get the property innerHTML

ex: (note these codes are pseudo-codes, I don't remember exact syntaxes)

var element=driver.find_element_by_id('div_id');
var text=element.get_attribute('innerHTML');
Dharman
  • 30,962
  • 25
  • 85
  • 135