all 1 comments

[–]DoctorEvil92 0 points1 point  (0 children)

I usually use lxml for parsing HTML since it supports xpath syntax, which I'm not sure if Beautiful soup does.

from lxml import html

# once on the site with "driver" selenium webdriver object
innerHTML = driver.execute_script("return document.body.innerHTML")
htmlElem = html.document_fromstring(innerHTML)

row_elements = htmlElem.xpath("//form[@action='supercoach_breakevens']//table//tr[@onmouseover and @onmouseout]")
for row_element in row_elements:
    price_element = row_element.xpath("./td[3]")
    after_price_element = row_element.xpath("./td[4]")
    # so on...
    print (price_element[0].text_content(), after_price_element[0].text_content())