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



[((17, 20, 17, 29), 'reuse_func.GetData', 'GetData', ({}, {}), '()', False, 'from reuse_func import GetData\n'), ((18, 17, 18, 22), 'get_dir.pwd', 'pwd', ({}, {}), '()', False, 'from get_dir import pwd\n'), ((25, 8, 25, 21), 'time.sleep', 'time.sleep', ({(25, 19, 25, 20): '(4)'}, {}), '(4)', False, 'import time\n'), ((27, 8, 27, 21), 'time.sleep', 'time.sleep', ({(27, 19, 27, 20): '(2)'}, {}), '(2)', False, 'import time\n'), ((28, 15, 28, 44), 'os.path.isfile', 'os.path.isfile', ({(28, 30, 28, 43): 'self.filename'}, {}), '(self.filename)', False, 'import os\n'), ((29, 8, 29, 32), 'os.remove', 'os.remove', ({(29, 18, 29, 31): 'self.filename'}, {}), '(self.filename)', False, 'import os\n')]