def getBlockJobsAndApply(): us = User('f') if os.path.isfile(us.personal['LogPathJobsInGeneva']): reflst = DL.getReferencesFromLog(us.personal['LogPathJobsInGeneva']) else: reflst = set() #here, unlike in pagepersonnel, the mainurl #contains already every job browser = BO.openNewBrowser(MAINURL) #we are now in page 1 of the results #for each page I wish to apply to every job applyToAllUrls(browser, reflst, us) while BO.isElementPresent(browser,'Next', 'link'): element = browser.find_element_by_link_text('Next') url = element.get_attribute('href') browser.get(url) applyToAllUrls(browser, reflst, us) time.sleep(2) time.sleep(5)
def applyToAllUrls(browser, reflst, us): jobsearchurl = browser.current_url res = getJobSearchResults(browser) links = BO.getLinksFromElements(res) for link in links: browser.get(link) # we must verify that the page is the standard application page # neither is from indeed, or a vacancy completed or forbiden if BO.isElementPresent(browser,'searchContainer'): #if this element is present, we are in the correct page details = getJobDetails(browser) details['path'] = us.personal['LogPathJobsInGeneva'] if str(details['reference']) not in reflst: applyToJob(browser, us) details['method'] = 'CV' DL.writeLogToCSV(details) reflst.add(details['reference']) time.sleep(2) browser.get(jobsearchurl) time.sleep(3)
def getBlockJobsAndApply(): us = User('f') if os.path.isfile(us.personal['LogPathPagePersonnel']): reflst = DL.getReferencesFromLog(us.personal['LogPathPagePersonnel']) else: reflst = set() browser = BO.openNewBrowser(MAINURL) getBlockJobs(browser, 'Technology') toggleFilters(browser) selectLanguage(browser) #we are now in page 1 of the results #for each page I wish to apply to every job applyToAllUrls(browser, reflst, us) while BO.isElementPresent(browser, 'show-more-pager'): element = browser.find_element_by_class_name('show-more-pager') element = element.find_element_by_tag_name('a') url = element.get_attribute('href') browser.get(url) applyToAllUrls(browser, reflst, us) time.sleep(2) time.sleep(5)
def applyThroughWebSite(browser, us): if BO.isElementPresent( browser, 'CPHMain_CPHContent_CandidateLogin1_Login1_UserName', how='id'): loginToSite(browser, us) BO.waitForElementLocated( browser, 'ctl00_CPHMain_CPHContent_AsyncFileUploader_RadAsyncUpload1file0', how='id') browser.find_element_by_id( 'ctl00_CPHMain_CPHContent_AsyncFileUploader_RadAsyncUpload1file0' ).send_keys(us.personal['CVPath']) browser.execute_script( "document.getElementById('CPHMain_CPHContent_rdoCandidateFiles_4').click();" ) with open(us.personal['CoverText1'], 'r') as myfile: data = myfile.read() browser.find_element_by_id('CPHMain_CPHContent_txtCoverNote').send_keys( data) time.sleep(2) browser.execute_script( "document.getElementById('CPHMain_CPHContent_btnSubmit').click();")
def getBlockJobsAndApply(): us = User('f') if os.path.isfile(us.personal['LogPathExperis']): reflst = DL.getReferencesFromLog(us.personal['LogPathExperis']) else: reflst = set() browser = BO.openNewBrowser(MAINURL) #we are now in page 1 of the results #for each page I wish to apply to every job applyToAllUrls(browser, reflst, us) BO.waitForElementLocated(browser, 'pagingHeader_lnkNextPageItem', how='id', delay=30) #BUG : TODO while BO.isElementPresent(browser, 'pagingHeader_lnkNextPageItem', how='id'): browser.execute_script( "document.getElementById('pagingHeader_lnkNextPageItem').click();") applyToAllUrls(browser, reflst, us) time.sleep(2) time.sleep(10)