Exemple #1
0
def upload(driver,phototext, photopath):

    driver.find_element_by_xpath("//div[@role='menuitem']").click()
    time.sleep(1.5)
    
    autoit.win_active("Open") #open can change by your os language if not open change that
    time.sleep(2)
    autoit.control_send("Open", "Edit1", photopath)
    time.sleep(1.5)
    autoit.control_send("Open", "Edit1", "{ENTER}")
    time.sleep(2)
    driver.find_element_by_xpath("//*[@id='react-root']/section/div[1]/header/div/div[2]/button").click()
    time.sleep(1)
    
    ta= driver.find_elements(By.XPATH, '//textarea')
    
    for part in phototext.split('\n'):
        pp (part)
        if part:
            ta[0].send_keys(part)
            ActionChains(driver).key_down(Keys.SHIFT).key_down(Keys.ENTER).key_up(Keys.SHIFT).key_up(Keys.ENTER).perform()
        else:
            pass
    time.sleep(1)
        
    driver.find_element_by_xpath("//*[@id='react-root']/section/div[1]/header/div/div[2]/button").click()
Exemple #2
0
    def upload_image(self, file_path, description=''):
        # 1. Click upload image button
        print('Clicking `upload` button...')
        self.driver.find_element_by_xpath("//div[@role='menuitem']").click()
        time.sleep(2)

        # 2. Get the windows file explorer window that opened
        # Add the image path and click enter
        print('Uploading image to file explorer...')
        autoit.win_active("Open")
        autoit.control_send("Open", "Edit1", file_path)
        autoit.control_send("Open", "Edit1", "{ENTER}")
        time.sleep(2)

        # 3. Image should import and click Next button
        print('Image importing and processed to description...')
        self.driver.find_element_by_xpath('//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click()
        time.sleep(2)

        # 4. Add description
        print('Adding description...')
        self.driver.find_element_by_xpath('//*[@id="react-root"]/section/div[2]/section[1]/div[1]/textarea').click()
        self.driver.find_element_by_xpath('//*[@id="react-root"]/section/div[2]/section[1]/div[1]/textarea').send_keys(description)
        time.sleep(2)

        # 5. CLick Share
        print('Clicking `Share`!')
        if self.dry_run:
            print('DRY RUN IS ENABLED! - Therefore, not actually posting to IG.')
        else:
            self.driver.find_element_by_xpath('//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click()
        time.sleep(4)
        print('Upload completed.')
Exemple #3
0
def uploadLocalPhotoWithCaption(path_to_photo, caption):
    # example: path_to_photo = r"C:\images\something.png"
    print('⬆️ ⬆️ Uploading Local Photo ⬆️ ⬆️ ⬆️')
    goToMainPage()
    dismissPopup()

    print('Clicking add button')
    driver.find_element_by_xpath(
        '//*[@id="react-root"]/section/nav[2]/div/div/div[2]/div/div/div[3]'
    ).click()

    sleep(1.5)
    print('Openning File browser')
    autoit.win_active("Open")
    sleep(2)
    print('Typing image path')
    autoit.control_send("Open", "Edit1", path_to_photo)
    sleep(1.5)
    print('Submitting image')
    autoit.control_send("Open", "Edit1", "{ENTER}")
    sleep(2)

    print('Going for next step')
    next_btn = driver.find_element_by_xpath(
        "//button[contains(text(),'Next')]").click()

    sleep(1.5)
    print('Adding caption')
    caption_field = driver.find_element_by_xpath(
        "//textarea[@aria-label='Write a caption…']")
    caption_field.send_keys(caption)

    print('Sharing image')
    share_btn = driver.find_element_by_xpath(
        "//button[contains(text(),'Share')]").click()
Exemple #4
0
def upload(username, password, path, desc):
    #setup
    setup_phone(username, password)

    #upload the image
    print('UPLOAD')
    driver.find_element_by_xpath('//*[@id="react-root"]/section/nav[2]/div/div/div[2]/div/div/div[3]').click()
    time.sleep(2)

    #select image from the pc
    autoit.win_active("Apri") #open can change by your os language if not open change that
    time.sleep(2)
    autoit.control_send("Apri", "Edit1", path)
    time.sleep(1.5)
    autoit.control_send("Apri", "Edit1", "{ENTER}")
    time.sleep(3)
    print('Posting...')

    #adjust image
    driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
    driver.find_element_by_xpath('//*[@id="react-root"]/section/div[2]/div[2]/div/div/div/button[1]').click()
    time.sleep(1)
    driver.find_element_by_xpath('//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click()
    time.sleep(0.5)

    #set description
    driver.find_element_by_xpath('//*[@id="react-root"]/section/div[2]/section[1]/div[1]/textarea').send_keys(desc)

    #publish
    driver.find_element_by_xpath('//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click()
    driver.close()
    def upload(self, filePath):
        xx = filePath[1:2]
        print(xx)
        if (filePath[1:2] != ':'):
            #是相对路径 要到files下面去找
            pwd = os.getcwd()
            tmp = pwd.split("src")[0]
            tmp = os.path.abspath(tmp + os.path.sep + "..") + "\\files"

            filePath = filePath.replace("/", "\\")
            if (not filePath.startswith("\\")):
                filePath = "\\" + filePath
            filePath = tmp + filePath

        dirPath = os.path.dirname(filePath)
        if (not dirPath.endswith('\\')):
            dirPath = dirPath + '\\'

        l = len(dirPath)
        fileName = filePath[l:]

        #下面开始是在上传对话框上的操作
        time.sleep(1)
        autoit.win_active("打开")
        autoit.control_set_text("打开", "Edit1", dirPath)

        time.sleep(0.5)

        autoit.control_click("打开", "Button1")

        time.sleep(3)

        autoit.control_set_text("打开", "Edit1", fileName)

        autoit.control_click("打开", "Button1")
 def file_upload_india(self):
     autoit.win_active("Open")
     autoit.control_set_text(
         "Open", "Edit1",
         r"C:\selenium_scripts\upload\AppointmentUpload_IND.xlsx")
     autoit.control_send("Open", "Edit1", "{ENTER}")
     time.sleep(2)
Exemple #7
0
def post(user, password, image, caption):
    if os.name != 'nt':
        keyboard = Controller()
    driver = login(user, password)
    driver.find_element_by_xpath("//div[@role='menuitem']").click()
    passed = False
    while passed == False:
        passed = True
        try:
            if os.name == 'nt':
                autoit.win_active("Open")
                sleep(1)
                autoit.control_send("Open","Edit1",image)
                sleep(1)
                autoit.control_send("Open","Edit1","{ENTER}")
                sleep(0.5)
            else:
                keyboard.type(image)
                sleep(1)
                keyboard.press(Key.enter)
                keyboard.release(Key.enter)
                sleep(0.5)
        except:
            passed = False
            sleep(0.5) 
    passed = False
    while passed == False:
        passed = True
        try:
            driver.find_element_by_xpath("//button[@class='pHnkA']").click()
            sleep(0.5)
        except:
            passed = False
            sleep(0.5)
    passed = False
    while passed == False:
        passed = True
        try:
            driver.find_element_by_xpath("//button[contains(text(),'Next')]").click()
            sleep(0.5)
        except:
            passed = False
            sleep(0.5)
    passed = False
    while passed == False:
        passed = True
        try:
            write_a_caption = driver.find_element_by_xpath("//textarea[@aria-label='Write a caption…']")
        except:
            passed = False
            sleep(0.5)
    sleep(0.5)
    write_a_caption.send_keys(caption)
    sleep(0.5)
    exit()
    driver.find_element_by_xpath("//button[contains(text(),'Share')]").click()
    sleep(10)
    driver.close()
def Post(username, password, timer, usernames):  #posts the image
    files = os.listdir()
    imageFiles = [file for file in files if ".jpg" in file]

    user_agent = "Mozilla/4.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16"

    profile = webdriver.FirefoxProfile(
    )  #starts webbrowser emulating as a phone
    profile.set_preference("general.useragent.override", user_agent)
    driver = webdriver.Firefox(profile)
    driver.set_window_size(360, 640)

    url = "https://www.instagram.com"
    driver.get(url)
    time.sleep(4)
    Login(username, password, driver)  #logs in
    close_reactivated(driver)
    close_notification(driver)
    close_add_to_home(driver)
    close_notification(driver)
    print("Starting following")
    follow(usernames, driver)
    for i in range(len(imageFiles)):  #starts posting
        print("Posting " + imageFiles[i])
        image_path = (str(Path(__file__).parent.absolute()) + "\\" +
                      imageFiles[i])

        opened_image = Image.open(image_path)
        make_square(opened_image, image_path)

        new_post_btn = driver.find_element_by_xpath(
            "//div[@role='menuitem']").click()
        time.sleep(1.5)
        autoit.win_active("File Upload")
        time.sleep(2)
        autoit.control_send("File Upload", "Edit1", image_path)
        time.sleep(1.5)
        autoit.control_send("File Upload", "Edit1", "{ENTER}")
        try:
            time.sleep(1.5)
            autoit.control_send("File Upload", "Edit1", "{ENTER}")
        except:
            pass
        time.sleep(2)

        next_btn = driver.find_element_by_xpath(
            "//button[contains(text(),'Next')]").click()
        time.sleep(1.5)
        share_btn = driver.find_element_by_xpath(
            "//button[contains(text(),'Share')]").click()
        time.sleep(2)
        print("Unfollwing some people")
        unfollow(driver)
        time.sleep(timer)

    driver.close()  #ends driver
Exemple #9
0
def run():
    window = bring_bdo_top(refresh_wins())
    print(window)
    some_var = autoit.win_active(window)
    print(some_var)
    some_var_2 = autoit.win_activate(window)
    print(some_var_2)
    some_var = autoit.win_active(window)
    print(some_var)
    some_var = autoit.win_get_handle(window)
    time.sleep(2)
    autoit.control_send(window, "", "r")
Exemple #10
0
def upload(filename, old_uploader_url, file_window_title, file_folder):
    driver.get(old_uploader_url)
    time.sleep(10)
    upload_btn = driver.find_element_by_id('start-upload-button-single')
    hover = ActionChains(driver).move_to_element(upload_btn)
    time.sleep(3)
    hover.click().perform()
    time.sleep(3)
    autoit.win_active(file_window_title)
    filename = file_folder + filename
    autoit.control_send(file_window_title, "Edit1", filename)
    autoit.control_send(file_window_title, "Edit1", "{ENTER}")
    time.sleep(10)
    driver.find_elements_by_class_name('save-changes-button')[0].click()
Exemple #11
0
def post():
    print("Adding post")

    # Readies the content for instagram
    with open('filesDict.json', encoding="utf8") as json_file:

        # loads the data from the queue (filesDict.json)
        data = json.load(json_file)

        # if not empty
        if bool(data):

            # gets first item in filesDict.json and sets it as the next instagram upload
            # also sets the image path and caption
            image_path = os.getcwd(
            ) + "\\images\\" + data['dict'][0]['id'] + ".jpg"
            caption = data['dict'][0]['title']

            # Loops and removes the first item since it has just been uploaded
            for i in range(len(data)):
                if data['dict'][i]["id"] == data['dict'][0]['id']:
                    del data['dict'][i]
                    break

            # saves file without first item
            with open('filesDict.json', 'w', encoding="utf8") as outfile:
                json.dump(data, outfile)

    # Opens File Explore window
    print("Opening file explorer")
    autoit.win_active("Open")
    autoit.control_set_text("Open", "Edit1", image_path)
    autoit.control_send("Open", "Edit1", "{ENTER}")
    sleep(settings.wait_time)

    # depending on aspect ratio, sometimes this button does not exist
    try:
        driver.find_element_by_xpath(
            "//span[contains(text(),'Expand')]").click()
    except:
        pass
    sleep(settings.wait_time)

    # clicks through options and adds caption after file is added
    driver.find_element_by_xpath("//button[contains(text(),'Next')]").click()
    sleep(settings.wait_time)
    caption_field = driver.find_element_by_xpath(
        "//textarea[@aria-label='Write a caption…']")
    caption_field.send_keys(caption)
    driver.find_element_by_xpath("//button[contains(text(),'Share')]").click()
Exemple #12
0
def extract_rr(filename):
    pid = autoit.run("C:/Program Files/Kubios/Kubios HRV Standard/kubioshrv.exe")
    
    # wait until screen is loaded
    assert autoit.win_wait_active(f"[TITLE:{kubios_title}]", 30)
    time.sleep(0.25)
    
    # get position and click menu->open
    x, y, _, _ = autoit.win_get_pos(f"[TITLE:{kubios_title}]")
    assert autoit.mouse_click(x=x+20, y=y+50, speed=10)
    time.sleep(0.5)
    assert autoit.mouse_click(x=x+20, y=y+70, speed=10)
    
    # wait for loading of file input screen
    assert autoit.win_wait_active(f"[TITLE:{title_open}]", 30)
    time.sleep(0.25)
    assert autoit.control_send(f"[TITLE:{title_open}]", "[CLASS:Edit]", filename)
    time.sleep(0.25)
    assert autoit.control_click(f"[TITLE:{title_open}]", "[CLASS:Button; INSTANCE:1]")
    time.sleep(1)
    
    # check if there was an error (if Open Data File is still there)
    assert not autoit.win_active(f"[TITLE:{title_open}]"), 'Failed to load!'
    
    assert os.system(f"taskkill /PID {pid} /F")==0
Exemple #13
0
 def addfile(self, windowname, filename):
     '''pyautoit实现上传附件'''
     # autoit.mouse_click(x=630, y=255)
     sleep(1.5)
     if autoit.win_exists(windowname):
         autoit.win_active(windowname)
         autoit.mouse_click(x=1580, y=46)
         APPLICATION_PATH = self.Base_dir() + r'/data/uploadfile'
         autoit.send(APPLICATION_PATH)
         autoit.send('{ENTER}')
         autoit.mouse_click(x=780, y=970)
         autoit.send(filename)
         autoit.send('!o')
         sleep(1)
     else:
         raise Exception('没有打开文件窗口')
Exemple #14
0
 def win_active(cls, title, **kwargs):
     """
     call autoit.win_activate
     判断窗口是否激活
     timeout 单位为秒.
     :return PID:窗口存在; 0:窗口不存在.
     """
     return autoit.win_active(title, **kwargs)
def post(jpg_to_post):
    print("enter post()")

    mobile_emulation = {"deviceName": "Nexus 5"}
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
    driver = webdriver.Chrome(
        ChromeDriverManager().install(),
        desired_capabilities=chrome_options.to_capabilities())
    driver.get('https://www.instagram.com/accounts/login/')
    time.sleep(2)
    user_name = driver.find_element_by_xpath("//input[@name='username']")
    user_name.send_keys('Here Put your username or email')
    password = driver.find_element_by_xpath("//input[@name='password']")
    password.send_keys('Here put your Password')
    password.submit()
    #driver.find_element_by_xpath("//*[@class='sqdOP  L3NKy   y3zKF']").click()
    time.sleep(5)
    driver.find_element_by_xpath("//button[text()='Not Now']").click()
    time.sleep(5)
    driver.find_element_by_xpath("//button[text()='Cancel']").click()
    time.sleep(2)
    driver.find_element_by_xpath("//div[@role='menuitem']").click()
    time.sleep(2)
    autoit.win_active("Open")
    autoit.control_set_text("Open", "Edit1", jpg_to_post)
    autoit.control_send("Open", "Edit1", "{ENTER}")
    time.sleep(2)
    try:
        driver.find_element_by_xpath("//button[@class='_j7nl9']").click()
    except Exception:
        pass
    time.sleep(2)
    driver.find_element_by_xpath("//button[contains(text(),'Next')]").click()
    time.sleep(2)
    caption_field = driver.find_element_by_xpath(
        "//textarea[@aria-label='Write a caption…']")
    caption_field.send_keys(caption)
    time.sleep(2)
    #driver.find_element_by_xpath("//*[@class='_qlp0q']").send_keys(Keys.CONTROL, 'v')
    #time.sleep(2)
    driver.find_element_by_xpath("//button[contains(text(),'Share')]").click()
    time.sleep(5)

    driver.quit()
Exemple #16
0
def main_process(driver, cwd, file, fromlang, tolang):
    driver.get(
        "https://translate.google.com/#view=home&op=docs&sl={}&tl={}".format(
            fromlang, tolang))
    driver.find_element_by_id("tlid-file-input").send_keys(
        "{}/tempdir/{}".format(cwd, file))
    driver.find_element_by_class_name("tlid-translate-doc-button").click()
    currurl = driver.current_url
    path_wkhtmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
    config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)
    autoit.send("^p")
    time.sleep(2)
    autoit.send("{ENTER}")
    time.sleep(3)
    autoit.win_active("Save Print Output As")
    time.sleep(2)
    autoit.send("temporaryout_{}".format(file))
    autoit.send("{ENTER}")
    time.sleep(5)
Exemple #17
0
def rescale_upload():
    user = "******"
    pwd = "1055088S!dhu"

    # For Chrome
    opts = ChromeOptions()
    opts.add_experimental_option("detach", True)

    driver = webdriver.Chrome(
        "C:/Users/siddardha.teegela/Downloads/Softwares/chromedriver.exe",
        options=opts)
    driver.get("https://platform.rescale.com/")

    #Find login
    element = driver.find_element_by_id("id_username")
    element.send_keys(user)

    element = driver.find_element_by_id("id_password")
    element.send_keys(pwd)

    element.send_keys(Keys.RETURN)

    time.sleep(3)
    #file_click = driver.find_element_by_id("menuFiles")
    file_click = driver.find_element_by_xpath("//*[@id='menuFiles']/a")
    file_click.click()

    time.sleep(10)

    try:
        upload_file = driver.find_element_by_xpath(
            "//*[@id='filesPageDropZone']")
        upload_file.click()
        time.sleep(5)
        autoit.win_active("Open")
        autoit.control_send(
            "Open", "Edit1",
            r"C:\Users\siddardha.teegela\Downloads\testdoc1.txt")
        autoit.control_send("Open", "Edit1", "{ENTER}")
    except Exception as e:
        print(e, 'Could not upload file')

    time.sleep(50)
def addfile():
    '''上传附件流程'''
    autoit.mouse_click(x=630, y=255)
    sleep(3)
    if autoit.win_exists('打开文件'):
        autoit.win_active('打开文件')
        autoit.mouse_click(x=780, y=50)
        path = os.path.dirname(__file__)
        npos = 'IMTestScript'
        APPLICATION_PATH = Base.common_path(
            path=path, npos=npos) + r'IMTestScript\IM_Test\data\uploadfile'
        autoit.send(APPLICATION_PATH)
        autoit.send('{ENTER}')
        autoit.mouse_click(x=780, y=970)
        autoit.send('uploadfile_1.txt')
        autoit.send('!o')
        sleep(2)
    else:
        raise Exception('没有打开文件窗口')
Exemple #19
0
    def upload(self,a):
        driver=self.driver
        upload_button=driver.find_element_by_xpath("//div[@role='menuitem']")
        upload_button.click()
        time.sleep(2)
        autoit.win_active("Open") 
        time.sleep(2)
        #for x in range(n): #  multiple pics
        autoit.control_send("Open","Edit1",img[a])  #  check later
        time.sleep(2)
        autoit.control_send("Open","Edit1","{ENTER}")
        time.sleep(1.5)
        next_button=driver.find_element_by_class_name('UP43G')
        next_button.click()
        time.sleep(1.5)
        caption_area=driver.find_element_by_class_name('_472V_')
        caption_area.send_keys("Wow it got uploaded!!! ")
        share_but=driver.find_element_by_class_name('UP43G')
        share_but.click()
        time.sleep(5)        
        try:
            noti_pop_up=driver.find_element_by_class_name('piCib')
            noti_pop_up.click()
        except:
            pass
        time.sleep(3)
        
        try:
            noti_pop_up=driver.find_element_by_class_name('aOOlW   HoLwm ')
            noti_pop_up.click()
        except:
            pass

        try:
            not_now_button = driver.find_element_by_xpath("//button[contains(text(), 'Not Now')]")  #  write if condition for the popup
            not_now_button.click()
            time.sleep(2)
        except:
            pass

        time.sleep(2)
Exemple #20
0
    def upload_photo(self,image_path,caption):
        sleep(2)

        self.browser.find_element_by_xpath('/html/body/div[1]/section/nav[2]/div/div/div[2]/div/div/div[3]').click()
        sleep(2)
        autoit.win_active("Open")
        sleep(2)
        autoit.control_send("Open","Edit1",image_path) 
        sleep(2)
        autoit.control_send("Open","Edit1","{ENTER}")

        sleep(2)
        self.browser.find_element_by_xpath("//button[contains(text(),'Next')]").click()
        # self.browser.find_element_by_xpath('/html/body/div[1]/section/div[1]/header/div/div[2]').click()
        sleep(2)
        caption_field = self.browser.find_element_by_xpath("//textarea[@aria-label='Write a caption…']")
        caption_field.send_keys(caption)
        sleep(2)
        self.browser.find_element_by_xpath("//button[contains(text(),'Share')]").click()

        sleep(25)
Exemple #21
0
def upload_vid(username, password, path, desc, title):
    #setup
    setup(username, password)

    #go to profile
    driver.find_element_by_xpath('//*[@id="react-root"]/section/nav/div[2]/div/div/div[3]/div/div[5]/span/img').click()
    time.sleep(2)
    driver.find_element_by_xpath('//*[@id="react-root"]/section/nav/div[2]/div/div/div[3]/div/div[5]/div[2]/div/div[2]/div[2]/a[1]/div').click()
    time.sleep(3.5)
    driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/div[1]/a[2]/span/span').click()
    time.sleep(2.5)

    #upload igtv
    driver.find_element_by_css_selector('#react-root > section > main > div > div._2z6nI > div > div.SRori > div > a > button').click()
    time.sleep(3)
    driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/form/div/div[1]/label/div/div/div[2]').click()
    time.sleep(1)

    #select image from the pc
    autoit.win_active("Apri") #open can change by your os language if not open change that
    time.sleep(2)
    autoit.control_send("Apri", "Edit1", path)
    time.sleep(1.5)
    autoit.control_send("Apri", "Edit1", "{ENTER}")

    time.sleep(2)
    #wait for the video to upload
    while(driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/form/div/div[1]/label/div/div/div/div/div[2]').text != '100%'):
        time.sleep(1)

    #set title
    driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/form/div/div[2]/div[4]/div/div/input').send_keys(title)

    #set description
    driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/form/div/div[2]/div[5]/div/div/textarea').send_keys(desc)

    #publish
    driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/form/div/div[2]/div[9]/button').click()
    time.sleep(10)
    driver.close()
Exemple #22
0
def rescale_upload():
    user = "******"
    pwd = "xxxxxx"

    # For Chrome
    opts = ChromeOptions()
    opts.add_experimental_option("detach", True)

    driver = webdriver.Chrome("<chromedriver-path>", options=opts)
    driver.get("https://platform.rescale.com/")

    #Find login
    element = driver.find_element_by_id("id_username")
    element.send_keys(user)

    element = driver.find_element_by_id("id_password")
    element.send_keys(pwd)

    element.send_keys(Keys.RETURN)

    time.sleep(3)
    #file_click = driver.find_element_by_id("menuFiles")
    file_click = driver.find_element_by_xpath("//*[@id='menuFiles']/a")
    file_click.click()

    time.sleep(10)

    try:
        upload_file = driver.find_element_by_xpath(
            "//*[@id='filesPageDropZone']")
        upload_file.click()
        time.sleep(5)
        autoit.win_active("Open")
        autoit.control_send("Open", "Edit1", r"<file-path>")
        autoit.control_send("Open", "Edit1", "{ENTER}")
    except Exception as e:
        print('Could not upload file')

    time.sleep(50)
Exemple #23
0
def input_symptoms():
    paths = []
    if request.method == 'POST':
        instausername = str(request.form['instausername'])
        instapassword = str(request.form['instapassword'])
        duration = str(request.form['duration'])

    def input1():
        if request.method == 'POST':

            instausername = str(request.form['instausername'])
            instapassword = str(request.form['instapassword'])
            duration = str(request.form['duration'])

            directory = f"{instausername}"
            parent_dir = "C:\covid-copy2\static"

            path = os.path.join(parent_dir, directory)

            # Create the directory
            # 'GeeksForGeeks' in
            # '/home / User / Documents'
            try:
                os.mkdir(path)
            except:
                print("sdf")
            files = request.files.getlist('files[]')
            file_names = []
            for file in files:
                if file and allowed_file(file.filename):
                    filename = secure_filename(file.filename)
                    file_names.append(filename)
                    file.save(
                        os.path.join("static", f"{instausername}", filename))
                    paths.append(os.path.join(f"{instausername}", filename))

            return paths
            #else:
            #	flash('Allowed image types are -> png, jpg, jpeg, gif')
            #	return redirect(request.url)

    def google_predict(path):
        from google.cloud import vision
        from pillow_utility import draw_borders, Image
        import pandas as pd

        os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r"abc.json"
        client = vision.ImageAnnotatorClient()

        file_name = path
        image_path = os.path.join('', file_name)

        with io.open(image_path, 'rb') as image_file:
            content = image_file.read()

        image = vision.types.Image(content=content)

        response = client.object_localization(image=image)
        localized_object_annotations = response.localized_object_annotations

        pillow_image = Image.open(image_path)
        df = pd.DataFrame(columns=['name', 'score'])
        for obj in localized_object_annotations:
            df = df.append(dict(name=obj.name, score=obj.score),
                           ignore_index=True)
        return df

    def pop(lists):
        from pytrends.request import TrendReq

        # Create pytrends object, request data from Google Trends
        pytrends = TrendReq(hl='en-US', tz=360)

        # Extracts data based on our keywords
        kw_list = lists
        pytrends.build_payload(kw_list,
                               cat=0,
                               timeframe='today 5-y',
                               geo='',
                               gprop='')

        # Specify, get, and normalize data
        data = pytrends.interest_over_time()
        data.drop('isPartial', axis=1, inplace=True)
        normData = data.apply(lambda x: x / x.max(), axis=0)

        # Max normalized value from most recent date + index in list
        recent = normData.values[-1].tolist()
        max_value = max(recent)
        max_index = recent.index(max_value)

        # Name of most popular normalized item
        out = kw_list[max_index]
        pytrends.build_payload(kw_list=[out],
                               cat=0,
                               timeframe='today 5-y',
                               geo='',
                               gprop='')
        trend = pytrends.related_queries()
        trend_list = trend[out]['top']['query']

        # Adds variable number of hashtags to topList
        numHashtags = 5
        topList = []
        for i in range(numHashtags):
            topList.append(trend_list[i])

        # TopList is a list of hashtags, out is most popular item

        poplist = topList

        import pandas as pd
        from pytrends.request import TrendReq
        import pytrends
        from pytrends.request import TrendReq
        import pandas as pd
        import time
        import datetime
        import matplotlib.pyplot as plt
        import seaborn as sns
        from datetime import datetime, date, time
        pytrend = TrendReq()
        pytrend = TrendReq()
        pytrend.build_payload(kw_list,
                              timeframe='today 12-m',
                              geo='GB',
                              cat=71)

        interest_over_time_df = pytrend.interest_over_time()
        print(interest_over_time_df.head())

        sns.set(color_codes=True)
        dx = interest_over_time_df.plot.line(figsize=(9, 6),
                                             title="Interest Over Time")
        dx.set_xlabel('Date')
        dx.set_ylabel('Trends Index')
        dx.tick_params(axis='both', which='major', labelsize=13)
        dx.figure.savefig("static/output.png")

        return (poplist)

    def pop2(lists):
        from pytrends.request import TrendReq

        # Create pytrends object, request data from Google Trends
        pytrends = TrendReq(hl='en-US', tz=360)

        # Extracts data based on our keywords
        kw_list = lists
        pytrends.build_payload(kw_list,
                               cat=0,
                               timeframe='today 5-y',
                               geo='',
                               gprop='')

        # Specify, get, and normalize data
        data = pytrends.interest_over_time()
        data.drop('isPartial', axis=1, inplace=True)
        normData = data.apply(lambda x: x / x.max(), axis=0)

        # Max normalized value from most recent date + index in list
        recent = normData.values[-1].tolist()
        max_value = max(recent)
        max_index = recent.index(max_value)

        # Name of most popular normalized item
        out = kw_list[max_index]
        pytrends.build_payload(kw_list=[out],
                               cat=0,
                               timeframe='today 5-y',
                               geo='',
                               gprop='')
        trend = pytrends.related_queries()
        trend_list = trend[out]['top']['query']

        # Adds variable number of hashtags to topList
        numHashtags = 5
        topList = []
        for i in range(numHashtags):
            topList.append(trend_list[i])

        # TopList is a list of hashtags, out is most popular item

        poplist = out
        return (poplist)

    input1()
    list2 = []
    for item in paths:
        a = google_predict(item)
        list1 = a["name"].tolist()
        list2.append(statistics.mode(list1))

    if len(list2) == 0:
        print("hello world")

    else:
        df2 = pd.DataFrame(list(zip(list2, paths)), columns=['Name', 'path'])
        print("List2 is", list2)
        print("df2 is: ", df2)

        poplist2 = pop(list2)
        poplist3 = pop2(list2)
        print("poplist2 is", poplist2)
        print("poplist3 is", poplist3)
        index = list2.index(poplist3)

        path2 = os.path.join("../static", paths[index])
        print(path2)
        import autoit
        from time import sleep
        from selenium import webdriver
        from selenium.webdriver.chrome.options import Options
        from selenium.webdriver.common.action_chains import ActionChains

        username = instausername  #Enter your username
        password = instapassword  #Enter your password
        image_path = os.path.join(
            parent_dir, paths[index]
        )  #The written path is just an example, Delete the path and Enter the Path of your image. #1. path should not start with a back slash
        caption = f"Hey everyone! We are currently selling our new batch of {poplist3}. Come down to {instausername} to purchase some.    Tags: {poplist2}"  #Enter the caption

        mobile_emulation = {"deviceName": "Pixel 2"}
        opts = webdriver.ChromeOptions()
        opts.add_experimental_option("mobileEmulation", mobile_emulation)

        driver = webdriver.Chrome(
            executable_path=r"C:\covid-copy2\chromedriver.exe",
            options=opts)  #you must enter the path to your driver

        main_url = "https://www.instagram.com"
        driver.get(main_url)

        sleep(4)

        def login():
            login_button = driver.find_element_by_xpath(
                "//button[contains(text(),'Log In')]")
            login_button.click()
            sleep(3)
            username_input = driver.find_element_by_xpath(
                "//input[@name='username']")
            username_input.send_keys(username)
            password_input = driver.find_element_by_xpath(
                "//input[@name='password']")
            password_input.send_keys(password)
            password_input.submit()

        login()

        sleep(4)

        def close_reactivated():
            try:
                sleep(2)
                not_now_btn = driver.find_element_by_xpath(
                    "//a[contains(text(),'Not Now')]")
                not_now_btn.click()
            except:
                pass

        close_reactivated()

        def close_notification():
            try:
                sleep(2)
                close_noti_btn = driver.find_element_by_xpath(
                    "//button[contains(text(),'Not Now')]")
                close_noti_btn.click()
                sleep(2)
            except:
                pass

        close_notification()

        def close_add_to_home():
            sleep(3)
            close_addHome_btn = driver.find_element_by_xpath(
                "//button[contains(text(),'Cancel')]")
            close_addHome_btn.click()
            sleep(1)

        close_add_to_home()

        sleep(3)

        close_notification()

        new_post_btn = driver.find_element_by_xpath(
            "//div[@role='menuitem']").click()
        sleep(1.5)
        autoit.win_active("Open")
        sleep(2)
        autoit.control_send("Open", "Edit1", image_path)
        sleep(1.5)
        autoit.control_send("Open", "Edit1", "{ENTER}")

        sleep(2)

        next_btn = driver.find_element_by_xpath(
            "//button[contains(text(),'Next')]").click()

        sleep(1.5)

        caption_field = driver.find_element_by_xpath(
            "//textarea[@aria-label='Write a caption…']")
        caption_field.send_keys(caption)

        share_btn = driver.find_element_by_xpath(
            "//button[contains(text(),'Share')]").click()

        sleep(25)
        driver.close()

        len2 = len(poplist2)

    return render_template('dashboard.html',
                           caption=caption,
                           path2=path2,
                           poplist2=poplist2,
                           len2=len2)
def caesar(username, password, image_path, caption):
    # Variables
    #image_path = r"%s" % imagepath #1. path should not start with a back slash
    firstrun = os.path.isdir('selenium')

    # Configuration Chrome
    mobile_emulation = {"deviceName": "Pixel 2"}
    opts = webdriver.ChromeOptions()
    opts.add_argument(
        "user-data-dir=selenium"
    )  # Source: https://stackoverflow.com/questions/15058462/how-to-save-and-load-cookies-using-python-selenium-webdriver
    opts.add_experimental_option("mobileEmulation", mobile_emulation)

    # Loads ChromeWebdriver
    driver = webdriver.Chrome(
        executable_path=r"chromedriver.exe",
        options=opts)  # you must enter the path to your driver

    # Opens Instagram.com
    main_url = "https://www.instagram.com"
    driver.get(main_url)

    sleep(4)

    def login():
        login_button = driver.find_element_by_xpath(
            "//button[contains(text(),'Log In')]")
        login_button.click()
        sleep(3)
        username_input = driver.find_element_by_xpath(
            "//input[@name='username']")
        username_input.send_keys(username)
        password_input = driver.find_element_by_xpath(
            "//input[@name='password']")
        password_input.send_keys(password)
        password_input.submit()

    # Closing reactivated Popup
    def close_reactivated():
        try:
            sleep(2)
            not_now_btn = driver.find_element_by_xpath(
                "//a[contains(text(),'Not Now')]")
            not_now_btn.click()
        except:
            pass

    # Closing notification Popup
    def close_notification():
        try:
            sleep(2)
            close_noti_btn = driver.find_element_by_xpath(
                "//button[contains(text(),'Not Now')]")
            close_noti_btn.click()
            sleep(2)
        except:
            pass

    # Closing add to Home Popup
    def close_add_to_home():
        sleep(3)
        close_addHome_btn = driver.find_element_by_xpath(
            "//button[contains(text(),'Cancel')]")
        close_addHome_btn.click()
        sleep(1)

    # Checks if Script run before
    if firstrun:
        print("used the cookies")
        sleep(2)
        close_notification()
        sleep(2)
    else:
        login()
        print("Fresh Login, takes longer")
        close_notification()
        close_reactivated()
        sleep(4)
        close_add_to_home()
        sleep(3)
        close_notification()

    # Posting Picture
    new_post_btn = driver.find_element_by_xpath("//div[@role='menuitem']")
    new_post_btn.click()
    sleep(1.5)
    autoit.win_active("Open")
    sleep(2)
    autoit.control_send("Open", "Edit1", image_path)
    sleep(1.5)
    autoit.control_send("Open", "Edit1", "{ENTER}")

    sleep(2)

    next_btn = driver.find_element_by_xpath(
        "//button[contains(text(),'Next')]")
    next_btn.click()

    sleep(1.5)

    caption_field = driver.find_element_by_xpath(
        "//textarea[@aria-label='Write a caption…']")
    caption_field.send_keys(caption)

    share_btn = driver.find_element_by_xpath(
        "//button[contains(text(),'Share')]")
    share_btn.click()
    # --

    sleep(25)
    driver.close()
Exemple #25
0
def post():
    z = photo()
    tags = "#anime #manga #otaku #art #animeart #animegirl #cosplay #naruto #kawaii #animeedits #fanart #drawing #animememes #memes #animeedit #cute #love #meme #animes #japan #onepiece #digitalart #animelover #edit #weeb #artist #animelove #like #cosplayer #bot"
    username = ""
    passwd = ""
    driverpth = "C:\\Program Files (x86)\\chromedriver.exe"
    photopath = "C:\\Users\\abuba\\OneDrive\\Desktop\\otakukamisama\\1.jpg"
    phototext = "Anime: " + z[0] + "-" "Synopsis: " + z[
        1] + "\n.\n.\n.\n.\n.\n.\n.\n.Tags: \n" + tags

    options = Options()
    options.add_argument("--log-level=3")
    options.add_argument("--silent")
    options.add_argument("--no-sandbox")
    options.add_argument("--disable-logging")
    options.add_argument("--mute-audio")
    options.add_argument(
        '--user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1'
    )
    driver = webdriver.Chrome(executable_path=driverpth, options=options)
    driver.get("https://www.instagram.com/accounts/login/")
    time.sleep(3)
    driver.find_element_by_xpath(
        "/html/body/div[1]/section/main/article/div/div/div/form/div[1]/div[3]/div/label/input"
    ).send_keys(username)
    time.sleep(0.5)
    driver.find_element_by_xpath(
        "/html/body/div[1]/section/main/article/div/div/div/form/div[1]/div[4]/div/label/input"
    ).send_keys(passwd)
    time.sleep(0.5)
    driver.find_element_by_xpath(
        "/html/body/div[1]/section/main/article/div/div/div/form/div[1]/div[6]"
    ).click()
    time.sleep(5)
    driver.find_element_by_xpath(
        "/html/body/div[1]/section/main/div/div/div/button").click()
    time.sleep(2)
    driver.find_element_by_xpath(
        "/html/body/div[4]/div/div/div/div[3]/button[2]").click()

    driver.find_element_by_xpath("//div[@role='menuitem']").click()
    time.sleep(1.5)
    autoit.win_active(
        "Open")  #open can change by your os language if not open change that
    time.sleep(2)
    autoit.control_send("Open", "Edit1", photopath)
    time.sleep(1.5)
    autoit.control_send("Open", "Edit1", "{ENTER}")
    time.sleep(2)
    i = 0

    while i < 2:
        #for scrolling page
        driver.execute_script("window.scrollBy(0,document.body.scrollHeight)")

        i += 1
    driver.find_element_by_xpath(
        "/html/body/div[1]/section/div[2]/div[2]/div/div/div/button[1]/span"
    ).click()
    time.sleep(2)
    driver.find_element_by_xpath(
        "//*[@id='react-root']/section/div[1]/header/div/div[2]/button").click(
        )
    time.sleep(1)
    driver.find_element_by_xpath(
        "//*[@id='react-root']/section/div[2]/section[1]/div[1]/textarea"
    ).send_keys(phototext)
    time.sleep(1)
    driver.find_element_by_xpath(
        "//*[@id='react-root']/section/div[1]/header/div/div[2]/button").click(
        )
    time.sleep(4)
    driver.close()
    def postImage(self):
        print('----------ATTEMPTING TO UPLOAD FILE TO INSTAGRAM-----------')
        # -*- setting chrome options to virtual iphone -*-
        chrome_options = Options()

        chrome_options.add_argument(
            "--user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1"
        )

        chrome_options.add_argument("window-size=250,800")

        driverName = '../Assets/Drivers/'
        if platform == 'linux' or platform == 'linux2':
            driverName = driverName + 'chromedriver_linux'
        elif platform == 'darwin':
            driverName = driverName + 'chromedriver_osx'
        elif platform == 'win32':
            driverName = driverName + 'chromedriver_windows_v79'

        driver = webdriver.Chrome(driverName, options=chrome_options)

        print('----------CHROME IPHONE DRIVER CONFIGURED AND READY-----------')
        print('Waiting for page to load...')

        driver.get("https://www.instagram.com")

        time.sleep(random.randint(5, 10))

        # -*- Clicking login button on instagram homepage -*-
        driver.find_element_by_xpath(
            "//button[contains(text(),'Log In')]").click()

        print('----------LOGIN BUTTON SELECTED-----------')
        print('Waiting for page to load...')

        time.sleep(random.randint(5, 10))

        # -*- Finding username/ password boxes and inputting data respectively -*-
        inputElementName = driver.find_element_by_xpath(
            "//input[contains(@name,'username')]")
        inputElementName.send_keys(username)

        inputElementPassword = driver.find_element_by_xpath(
            "//input[contains(@name,'password')]")
        inputElementPassword.send_keys(password)

        print('----------USERNAME AND PASSWORD ENTERED-----------')

        # -*- clicking login button -*-
        driver.find_element_by_xpath(
            "//div[contains(text(),'Log In')]").click()

        print('----------LOGIN SUCCESSFUL-----------')
        print('Waiting for page to load...')
        time.sleep(random.randint(5, 10))

        try:
            driver.find_element_by_xpath(
                "//button[contains(@class,'GAMXX')]").click()
            print('----------EXTRA POPUP FOUND AND ADVOIDED-----------')
            print('Waiting for page to load...')
            time.sleep(random.randint(5, 10))
        except:
            print('--------EXTRA POPUP NOT FOUND--------')

        try:
            driver.find_element_by_xpath(
                "//button[contains(@class,'aOOlW   HoLwm')]").click()
            print('----------EXTRA POPUP FOUND AND ADVOIDED-----------')
            print('Waiting for page to load...')
            time.sleep(random.randint(5, 10))
        except:
            print('--------EXTRA POPUP NOT FOUND--------')
        # -*- exiting popup -*-
        try:
            driver.find_element_by_css_selector(
                "body:nth-child(2) div:nth-child(1) div.HpHcz div:nth-child(3) > a._3m3RQ._7XMpj"
            ).click()
            print('----------POPUP IGNORED-----------')
            print('Waiting for page to load...')
            time.sleep(random.randint(5, 10))
        except:
            print('--------POPUP NOT FOUND--------')

        # -*- exiting popup -*-
        try:
            driver.find_element_by_xpath(
                "//button[contains(text(), 'Cancel')]").click()

            print('----------POPUP IGNORED-----------')
            print('Waiting for page to load...')

            time.sleep(random.randint(5, 10))
        except:
            print('--------POPUP NOT FOUND--------')

        # -*- removing old post -*-
        driver.find_element_by_xpath("//div[5]//a[1]").click()
        time.sleep(random.randint(5, 10))
        driver.find_element_by_xpath(
            "//body//div[contains(@class,'_2z6nI')]//div//div//div[1]//div[1]//a[1]//div[1]//div[2]"
        ).click()
        time.sleep(random.randint(5, 10))
        driver.find_element_by_xpath(
            "//span[contains(@class,'glyphsSpriteMore_horizontal__outline__24__grey_9 u-__7')]"
        ).click()
        time.sleep(random.randint(5, 10))
        driver.find_element_by_xpath(
            "//button[contains(text(),'Delete')]").click()
        time.sleep(random.randint(5, 10))
        driver.find_element_by_xpath(
            "//button[contains(text(),'Delete')]").click()
        time.sleep(random.randint(5, 10))

        # -*- uploading local image to story -*-
        element = driver.find_element_by_xpath(
            "//div[@class='q02Nz _0TPg']").click()
        time.sleep(random.randint(1, 3))
        autoit.win_active(
            "Open"
        )  #open can change by your os language if not open change that
        time.sleep(random.randint(2, 5))
        autoit.control_send("Open", "Edit1", os.getcwd() + self.fileName)
        time.sleep(random.randint(1, 3))
        autoit.control_send("Open", "Edit1", "{ENTER}")

        print('----------FILE UPLOADED SUCCESSFULY-----------')
        print('Waiting for page to load...')

        time.sleep(random.randint(2, 5))

        driver.find_element_by_xpath(
            "//span[@class='Szr5J createSpriteExpand']").click()

        print('----------FILE SUBMITTED-----------')
        print('Waiting for page to load...')

        time.sleep(random.randint(2, 5))
        driver.find_element_by_xpath("//button[@class='UP43G']").click()
        #Adding location
        time.sleep(random.randint(2, 5))
        driver.find_element_by_xpath("//section[2]//button[1]").click()
        time.sleep(random.randint(2, 5))
        driver.find_element_by_xpath(
            "//input[@placeholder='Find a location']").send_keys(
                Strings.burlington)
        time.sleep(random.randint(2, 5))
        driver.find_element_by_xpath(
            "//div[contains(@class,'BYCcJ')]//button[1]").click()
        time.sleep(random.randint(2, 5))
        #Adding caption
        time.sleep(random.randint(2, 5))
        driver.find_element_by_xpath(
            "//textarea[@placeholder='Write a caption…']").send_keys(
                Strings.caption)
        driver.find_element_by_xpath("//button[@class='UP43G']").click()
        print('----------FILE POSTED SUCCESSFULLY-----------')

        driver.close()
        print('----------DRIVER HAS EXITED-----------')
    sleep(3)
    close_addHome_btn = driver.find_element_by_xpath(
        "//button[contains(text(),'Cancel')]")
    close_addHome_btn.click()
    sleep(1)


close_add_to_home()

sleep(3)

close_notification()

new_post_btn = driver.find_element_by_xpath("//div[@role='menuitem']").click()
sleep(1.5)
autoit.win_active("Open")
sleep(2)
autoit.control_send("Open", "Edit1", image_path)
sleep(1.5)
autoit.control_send("Open", "Edit1", "{ENTER}")

sleep(2)

next_btn = driver.find_element_by_xpath(
    "//button[contains(text(),'Next')]").click()

sleep(1.5)

caption_field = driver.find_element_by_xpath(
    "//textarea[@aria-label='Write a caption…']")
caption_field.send_keys(caption)
Exemple #28
0
n = randint(2, 5)
time.sleep(n)
browser.find_element_by_xpath(
    "/html/body/div[4]/div/div/div[3]/button[2]").click()
# while 1:
#     time.sleep(1)
#     try:
#         driver.find_element_by_xpath("/html/body/div[4]/div/div/div[3]/button[2]").click()
#         break
#     except:
#         pass
n = randint(2, 5)
time.sleep(n)
browser.find_element_by_xpath(
    "/html/body/div[1]/section/nav[2]/div/div/div[2]/div/div/div[3]").click()
autoit.win_active(
    "Open")  #open can change by your os language if not open change that
n = randint(2, 5)
time.sleep(n)
autoit.control_send("Open", "Edit1",
                    os.path.join(os.getcwd(), "Post", "post.png"))
n = randint(2, 5)
time.sleep(n)
autoit.control_send("Open", "Edit1", "{ENTER}")
n = randint(2, 5)
time.sleep(n)
browser.find_element_by_xpath(
    "/html/body/div[1]/section/div[1]/header/div/div[2]/button").click()
n = randint(2, 5)
time.sleep(n)
caption = text.replace("\n", " ")
caption = caption + "\n.\n.\n.\n.\n.\n.\n.\n.\n#motivation #getstarted #nevergiveup #dontgiveup #happy #life #goals"
Exemple #29
0
def create_nft(driver, info, sale_info={}):
    if 'image' not in info: return
    if 'name' not in info: return

    # Explicitly navigate to collections
    driver.get('https://opensea.io/collections')

    # Select the first collection (one must be pre-made)
    seltools.wait_for_element(
        driver, '//div[contains(@class,"ImageCardreact")]').click()
    seltools.wait_for_element(
        driver, '//a//div[contains(@class,"ActionButtonreact")]').click()

    # Sign with wallet
    goto_tab(driver, tab=1)
    seltools.wait_for_page_load(driver)
    mm_bullshit_bypass(driver)
    mm_accept_all_popups(driver)
    single_tab(driver)

    # Now we are on the create page. Good. We upload our file and hit go

    # Upload an image
    # Yes, this is ugly. Yes, this isn't ideal,
    # but I couldn't get send_keys or setting the value with js to work
    seltools.wait_for_element(
        driver,
        '//div[contains(@class,"MediaInput") and contains(@class,"wrapper")]'
    ).click()
    time.sleep(2.0)
    autoit.win_active('Open')
    autoit.control_set_text('Open', 'Edit1', info['image'])
    autoit.control_send('Open', 'Edit1', '{ENTER}')

    # Fill in all other fields
    driver.find_element_by_xpath('//label[@for="name"]/..//input').send_keys(
        info['name'])

    if 'link' in info and len(info['link']) > 0:
        driver.find_element_by_xpath(
            '//label[@for="external_link"]/..//input').send_keys(info['link'])

    if 'description' in info and len(info['description']) > 0:
        driver.find_element_by_xpath(
            '//label[@for="description"]/..//input').send_keys(
                info['description'])

    def property_fillin(driver, infoname: str, start_xpath: str,
                        row_input_box_xpaths: tuple or list):
        if 'opensea.io/collection' not in driver.current_url: return
        if 'assets/create' not in driver.current_url: return
        if infoname not in info or len(info[infoname]) == 0: return

        # I don't know why, but action chains are the only way I could do this without crashing.
        btn = driver.find_element_by_xpath(start_xpath)
        webdriver.common.action_chains.ActionChains(
            driver).move_to_element_with_offset(btn, 5, 5).click().perform()

        popup = seltools.wait_for_element(
            driver, '//div[contains(@class,"ModalV2react")]')

        # hit add more
        addmore = popup.find_elements_by_xpath(
            './/div[contains(@class,"ActionButtonreact")]')[0]
        for i in range(0, len(info[infoname]) - 1):
            addmore.click()
            driver.implicitly_wait(0.1)

        # loop over all table rows to fill in info
        i = 0
        for row in popup.find_elements_by_xpath(
                './/table//tr[contains(@class,"TrContainer")]'):
            for j in range(0, len(row_input_box_xpaths)):
                if j == 0:
                    val = list(info[infoname].items())[i][0]
                    input_box = row.find_element_by_xpath(
                        row_input_box_xpaths[0])
                else:
                    if isinstance(list(info[infoname].items())[i][1],
                                  tuple) or isinstance(
                                      list(info[infoname].items())[i][1],
                                      list):
                        val = list(info[infoname].items())[i][1][j - 1]
                    else:
                        val = list(info[infoname].items())[i][1]
                    input_box = row.find_element_by_xpath(
                        row_input_box_xpaths[j])
                driver.execute_script('arguments[0].value="arguments[1]"',
                                      input_box,
                                      str(val).replace('"', ''))
                input_box.click()
                input_box.send_keys(Keys.CONTROL, 'a')
                input_box.send_keys(val)
            i += 1

        # hit save
        popup.find_elements_by_xpath(
            './/div[contains(@class,"ActionButtonreact")]')[1].click()

    # Fill in properties
    property_fillin(driver, 'properties', '//form/div[5]/div/div[2]/div/div',
                    ('.//input[contains(@placeholder,"Character")]',
                     './/input[contains(@placeholder,"Male")]'))

    # Fill in levels
    property_fillin(driver, 'levels', '//form/div[6]/div/div[2]/div/div',
                    ('.//input[contains(@placeholder,"Speed")]',
                     './/table/tbody/tr/td[2]/div/div/input',
                     './/table/tbody/tr/td[3]/div/div/input'))

    # Fill in stats
    property_fillin(driver, 'stats', '//form/div[7]/div/div[2]/div/div',
                    ('.//input[contains(@placeholder,"Speed")]',
                     './/table/tbody/tr/td[2]/div/div/input',
                     './/table/tbody/tr/td[3]/div/div/input'))

    # Fill in unlockable content
    if 'unlocked' in info:
        driver.find_element_by_xpath('//div[@class="switch"]').click()
        txtbox = seltools.wait_for_element(
            driver, '//div[contains(@class, "unlockable-content")]//textarea')
        txtbox.click()
        txtbox.send_keys(info['unlocked'])

    # Create NFT!!!
    driver.find_element_by_xpath(
        '//div[contains(@class, "action")]//div[contains(@class, "DivButton")]'
    ).click()

    goto_tab(driver, tab=1)
    seltools.wait_for_page_load(driver)
    mm_bullshit_bypass(driver)
    mm_accept_all_popups(driver)
    single_tab(driver)

    # Wait for completion
    seltools.wait_for_element(
        driver,
        '//div//div[contains(@class,"collectionManagerAssetCreate")]/../header'
    )

    # If sale
    if sale_info and 'price' in sale_info:
        # Go to sale menu
        seltools.wait_for_element(
            driver,
            '//div//div[contains(@class,"collectionManagerAssetCreate")]//div[contains(@class,"done")]/a[2]/div'
        ).click()

        # Click on necessary type
        sale_type = 1 if 'type' in sale_info and (
            sale_info['type'] == 1
            or str(sale_info['type']).lower() == 'auction') else 0
        seltools.wait_for_element(
            driver,
            '//div[contains(@class,"AssetSellToggleType")]//div[contains(@data-testid,"AssetSellToggleType")]'
        )
        sale_option = driver.find_elements_by_xpath(
            '//div[contains(@class,"AssetSellToggleType")]//div[contains(@data-testid,"AssetSellToggleType")]'
        )
        sale_option = sale_option[sale_type % len(sale_option)]
        sale_option.click()

        # Fill in price
        driver.find_element_by_xpath(
            '//div[@class="container"]/div[1]//div[contains(@class,"PaymentTokenInput")]//input'
        ).send_keys(str(sale_info['price']))

        # Sell!
        driver.find_element_by_xpath(
            '//div[contains(@data-testid,"PostListing")]/div').click()

        goto_tab(driver, tab=1)
        seltools.wait_for_page_load(driver)
        mm_bullshit_bypass(driver)
        mm_accept_all_popups(driver)
        single_tab(driver)
        print('Sale Complete')
    def gmail_005(driver, logger, sheet1, TCName):
        Id_locator = (By.XPATH, "//*[@id='identifierId']")
        nextBtn1_locator = (By.XPATH, "//span[text()='Next']")
        password_locator = "//input[@class='whsOnd zHQkBf']"
        nextBtn2_locator = (By.XPATH, "//span[@class='RveJvd snByac']")
        compose_locator = "//div[@class='T-I J-J5-Ji T-I-KE L3']"
        to_locator = "//*[@id=':b3']"
        sub_locator = "//*[@id=':al']"
        attachment_locator = (By.XPATH, "//div[@class='a1 aaA aMZ']")
        send_locator = (By.XPATH, "//div[@class='T-I J-J5-Ji aoO T-I-atl L3']")
        googleAccount_locator = (By.XPATH, "//span[@class='gb_9a gbii']")
        signout_locator = "//*[@id='gb_71']"

        try:
            emailId = generic.fetchValueFromExcel(sheet1, TCName, "emailId")
            driver.find_element(*Id_locator).send_keys(emailId)
            driver.find_element(*nextBtn1_locator).click()
            time.sleep(10)
            password = WebDriverWait(driver, 50).until(
                EC.presence_of_element_located((By.XPATH, password_locator)))
            pswd = generic.fetchValueFromExcel(sheet1, TCName, "password")
            password.send_keys(pswd)
            driver.find_element(*nextBtn2_locator).click()
            compose = WebDriverWait(driver, 50).until(
                EC.presence_of_element_located((By.XPATH, compose_locator)))
            compose.click()
            time.sleep(10)

            recipient = generic.fetchValueFromExcel(sheet1, TCName,
                                                    "recipient")
            subject = generic.fetchValueFromExcel(sheet1, TCName, "subject")
            to = WebDriverWait(driver, 50).until(
                EC.presence_of_element_located((By.XPATH, to_locator)))
            to.send_keys(recipient)

            sub = WebDriverWait(driver, 50).until(
                EC.presence_of_element_located((By.XPATH, sub_locator)))
            sub.send_keys(subject)

            driver.find_element(*attachment_locator).click()

            autoit.win_active("File Upload")
            autoit.control_send("File Upload", "Edit1",
                                r"C:\Users\ACER\Desktop\download.jpg")

            autoit.control_send("File Upload", "Edit1", "{ENTER}")

            time.sleep(20)
            '''driver.find_element_by_xpath("//*[@id=':b3']").send_keys("*****@*****.**")
            driver.find_element_by_xpath("//*[@id=':al']").send_keys("Test_mail")'''
            driver.find_element(*send_locator).click()

            driver.find_element(*googleAccount_locator).click()

            signout = WebDriverWait(driver, 50).until(
                EC.presence_of_element_located((By.XPATH, signout_locator)))
            signout.click()
            logger.info("attachment made and mail sent")

        except Exception as ex:
            logger.error("exception raised is: ", ex)
            raise ex