from .webdriver_util import init


def query_google(keywords):
    print("Loading Firefox driver...")
    driver, waiter, selector = init()

    print("Fetching google front page...")
    driver.get("http://google.com")

    print("Taking a screenshot...")
    waiter.shoot("frontpage")

    print("Typing query string...")
    selector.get_and_clear("input[type=text]").send_keys(keywords)

    print("Hitting Enter...")
    selector.get("button").click()

    print("Waiting for results to come back...")
    waiter.until_display("#ires")

    print
    print("The top search result is:")
    print
    print('    "{}"'.format(selector.get("#ires a").text))
    print


if __name__ == '__main__':
    query_google('test')
from .webdriver_util import init


def query_google(keywords):
    print("Loading Firefox driver...")
    driver, waiter, selector, datapath = init()

    print("Fetching google front page...")
    driver.get("http://google.com")

    print("Taking a screenshot...")
    waiter.shoot("frontpage")

    print("Typing query string...")
    selector.get_and_clear("input[type=text]").send_keys(keywords)

    print("Hitting Enter...")
    selector.get("button").click()

    print("Waiting for results to come back...")
    waiter.until_display("#ires")

    print
    print("The top search result is:")
    print
    print('    "{}"'.format(selector.get("#ires a").text))
    print


if __name__ == '__main__':
    query_google('test')

Fix bug in example code
Fix bug in example code

Fixes:
line 6, in query_google
    driver, waiter, selector = init()
ValueError: too many values to unpack (expected 3)
  from .webdriver_util import init
  
  
  def query_google(keywords):
      print("Loading Firefox driver...")
-     driver, waiter, selector = init()
+     driver, waiter, selector, datapath = init()
  
      print("Fetching google front page...")
      driver.get("http://google.com")
  
      print("Taking a screenshot...")
      waiter.shoot("frontpage")
  
      print("Typing query string...")
      selector.get_and_clear("input[type=text]").send_keys(keywords)
  
      print("Hitting Enter...")
      selector.get("button").click()
  
      print("Waiting for results to come back...")
      waiter.until_display("#ires")
  
      print
      print("The top search result is:")
      print
      print('    "{}"'.format(selector.get("#ires a").text))
      print
  
  
  if __name__ == '__main__':
      query_google('test')
+ 
Fix bug in example code
## Code Before:
from .webdriver_util import init


def query_google(keywords):
    print("Loading Firefox driver...")
    driver, waiter, selector = init()

    print("Fetching google front page...")
    driver.get("http://google.com")

    print("Taking a screenshot...")
    waiter.shoot("frontpage")

    print("Typing query string...")
    selector.get_and_clear("input[type=text]").send_keys(keywords)

    print("Hitting Enter...")
    selector.get("button").click()

    print("Waiting for results to come back...")
    waiter.until_display("#ires")

    print
    print("The top search result is:")
    print
    print('    "{}"'.format(selector.get("#ires a").text))
    print


if __name__ == '__main__':
    query_google('test')
## Instruction:
Fix bug in example code
## Code After:
from .webdriver_util import init


def query_google(keywords):
    print("Loading Firefox driver...")
    driver, waiter, selector, datapath = init()

    print("Fetching google front page...")
    driver.get("http://google.com")

    print("Taking a screenshot...")
    waiter.shoot("frontpage")

    print("Typing query string...")
    selector.get_and_clear("input[type=text]").send_keys(keywords)

    print("Hitting Enter...")
    selector.get("button").click()

    print("Waiting for results to come back...")
    waiter.until_display("#ires")

    print
    print("The top search result is:")
    print
    print('    "{}"'.format(selector.get("#ires a").text))
    print


if __name__ == '__main__':
    query_google('test')
