Adding emails automatically for manuscriptcentral with selenium

I have a hard time standing manuscriptcentral. It is an absolute piece of crap. And unfortunately, it seems that the entire community is stuck with it. I am serving for AE for TCSVT this year. Like many journal publications, it was stuck with the crappy manuscriptcentral.

Just to be realistic, the hit rate of getting a reviewer is very low this day. I have created another tool to extract emails from hundreds of papers. I will now input close to 100 emails per manuscript to secure enough reviewers. It can take at least an hour to do that as manuscriptcentral do not have an import function. And the antiquated UI even expects an editor to input an email one by one.

So I tried to automate that using selenium. I am not an expert on that, but I saw another project using it and so tried to imitate what he did. It is part of the code below (after log in the page of the respective manuscript). And par is email extracted by my other tools. Basically, a csv file with the first two columns are the emails and names of the reviewers. The code is not very refined, but it did the trick.

 

from selenium.webdriver.common.by import By

for line in par.split('\n')[8:]:
    
    email=line.split(',')[0]
    firstname=line.split(',')[1].strip().split(' ')[0]
    lastname=line.split(',')[1].strip().split(' ')[1]    
    
    
    driver.switch_to.window(driver.window_handles[0])
    url='javascript:openCreateAccountPopup()'
    addReviewer = driver.find_element_by_xpath('//a[@href="'+url+'"]')
    addReviewer.click()


    driver.switch_to.window(driver.window_handles[1])
    # css_firstname = driver.find_element_by_css_selector('input[name="PERSON_FIRSTNAME"]')
    css_firstname=driver.find_element(By.NAME, "PERSON_FIRSTNAME")
    css_firstname.send_keys(firstname)
    css_lastname=driver.find_element(By.NAME, "PERSON_LASTNAME")
    css_lastname.send_keys(lastname)
    css_email=driver.find_element(By.NAME, "EMAIL_ADDRESS")
    css_email.send_keys(email)
    # css_firstname=driver.find_element(By.NAME, "XIK_ADD_FOUND_PERSON_ID")


    # add_reviewer_img = driver.find_element(By.src,"/images/en_US/buttons/create_add.gif")
    add_reviewer_img = driver.find_element(By.XPATH,"//img[@src='/images/en_US/buttons/create_add.gif']")

    add_reviewer_img.click()

    # case 1 (exist, save and add, best case)

    # add_reviewer_img = driver.find_element(By.src,"/images/en_US/buttons/create_add.gif")

    success=True
    try:
        add_reviewer_img = driver.find_element(By.XPATH,"//img[@src='/images/en_US/buttons/save_add.gif']")
        add_reviewer_img.click()
    except:
        success=False



    # case 2 (save and send email)

    # windows=driver.window_handles
    # print(windows)

    if not success:
        try:
            driver.switch_to.window(driver.window_handles[1])

            iframe = driver.find_element_by_name("bottombuttons")
            driver.switch_to.frame(iframe)


            # add_reviewer_img = driver.find_element(By.src,"/images/en_US/buttons/create_add.gif")
            add_save_send = driver.find_element(By.XPATH,"//img[@src='/images/en_US/buttons/save_send.gif']")

            add_save_send.click()
            success = True
        except:
            success = False

    # case 3 # select from existing, just pick one randomly


    if not success:
        try:
            add_save_send = driver.find_element(By.XPATH,"//img[@src='/images/en_US/buttons/add.gif']")
            add_save_send.click()
            success = True
        except:
            success = False

Copyright OU-Tulsa Lab of Image and Information Processing 2024
Tech Nerd theme designed by Siteturner