import os
import time

from selenium.webdriver.support.select import Select

from Data.parameters import Data
from get_dir import pwd
from reuse_func import GetData


class All_records_download():

    def __init__(self,driver):
        self.driver = driver
        self.filename =''
    def test_download_csv(self):
        self.data = GetData()
        self.p = pwd()
        self.driver.find_element_by_xpath(Data.hyper_link).click()
        self.data.page_loading(self.driver)
        colltype = Select(self.driver.find_element_by_name('collection_type'))
        colltype.select_by_visible_text(' Overall ')
        self.data.page_loading(self.driver)
        self.driver.find_element_by_id(Data.Download).click()
        time.sleep(4)
        self.filename = self.p.get_download_dir() + '/collectionType_all_data.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        os.remove(self.filename)
        return file



[((337, 346), 'reuse_func.GetData', 'GetData', ([], {}), '()\n', (344, 346), False, 'from reuse_func import GetData\n'), ((364, 369), 'get_dir.pwd', 'pwd', ([], {}), '()\n', (367, 369), False, 'from get_dir import pwd\n'), ((727, 740), 'time.sleep', 'time.sleep', (['(4)'], {}), '(4)\n', (737, 740), False, 'import time\n'), ((832, 845), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (842, 845), False, 'import time\n'), ((861, 890), 'os.path.isfile', 'os.path.isfile', (['self.filename'], {}), '(self.filename)\n', (875, 890), False, 'import os\n'), ((899, 923), 'os.remove', 'os.remove', (['self.filename'], {}), '(self.filename)\n', (908, 923), False, 'import os\n')]