Question: I know this question has been asked many times, but I still have a very simple question, what is the purpose of using a factory method if the initiation of an object is simple.

```
Interface Animal{
    eat();
}

class Dog implements Animal{

     public void eat(){System.out.println("dog eat");}
}

```

Assume I have a concrete Cat class and fish class implement the Animal interface.

So in this case, is it necessary to make 3 Factory to create the animals? I think we only use the factory method when the initialization is difficult.

Answer: 
No selenium needed, what was missing is the Referer header. The javascript function simply appends the order method to `http://financials.morningstar.com/finan/ajax/exportKR2CSV.html?&callback=?&t=XNAS:EXPE&region=usa&culture=en-US&cur=&order=` and the default one is `asc`.

```py
import requests

headers = {
'Referer': 'http://financials.morningstar.com/ratios/r.html?t=EXPE&region=usa&culture=en-US',
}

r = requests.get("http://financials.morningstar.com/finan/ajax/exportKR2CSV.html?&callback=?&t=XNAS:EXPE&region=usa&culture=en-US&cur=&order=asc", headers=headers)

csv = r.content

with open("EXPE Key Ratios.csv", "wb") as file:
    file.write(csv)

```
Ok, so I have been working on this, and the closest I have come is getting it into your downloads folder -- I have no clue how this website is interacting with the browser to invoke a direct download like this. If someone more knowledgeable on the back-end of all of this could explain how it works I would greatly appreciate it.

Anyways, here is my code for getting it to the downloads folder:

```
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

#Get a driver
driver = webdriver.Edge()

#Navigate to the page
driver.get('http://financials.morningstar.com/ratios/r.html?t=EXPE&region=usa&culture=en-US')

#This is the javascript function that is invoked.
driver.execute_script("exportKeyStat2CSV()")

#Close the browser
driver.quit()

```

This should place the csv in your downloads folder (wherever that is for edge).

To install the webdriver go [here](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/), download it and put it in the directory with your script. You will have to pip install selenium.