Having Trouble Extracting Flight Price Content Using selenium

By Howell Yu

I tried to extract some flight price information from but the screenshot I got is blank. Can anyone see what’s the problem?

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from bs4 import BeautifulSoup
url = "https://www.google.com/flights/explore/#explore;f=JFK,EWR,LGA;t=r-Mexico-0x84043a3b88685353%253A0xed64b4be6b099811;li=3;lx=12;d=2017-05-13"
driver = webdriver.PhantomJS()
dcap = dict(DesiredCapabilities.PHANTOMJS)
dcap["phantomjs.page.settings.userAgent"] = (my_agent)
driver = webdriver.PhantomJS(desired_capabilities = dcap,service_args=['--ignore-ssl-errors=true'])
driver.implicitly_wait(20)
driver.get(url)
driver.save_screenshot(r'flight_explorer.png')

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273