I'm new in Selenium with Python. I'm trying to scrape some data but I can't figure out how to parse outputs from commands like this:
driver.find_elements_by_css_selector("div.flightbox")
I was trying to google some tutorial but I've found nothing for Python.
Could you give me a hint?
find_elements_by_css_selector()
would return you a list ofWebElement
instances. Each web element has a number of methods and attributes available. For example, to get a inner text of the element, use.text
:You can also make a context-specific search to find other elements inside the current element. Taking into account, that I know what site are you working with, here is an example code to get the departure and arrival times for the first-way flight in a result box:
Make sure you study Getting Started, Navigating and Locating Elements documentation pages.