diff --git a/attachments/Microsoft-logo_rgb_c-gray@2x.png b/attachments/Microsoft-logo_rgb_c-gray@2x.png new file mode 100644 index 0000000..208459c Binary files /dev/null and b/attachments/Microsoft-logo_rgb_c-gray@2x.png differ diff --git a/attachments/finger_print_icon_2x.png b/attachments/finger_print_icon_2x.png new file mode 100644 index 0000000..ee58f52 Binary files /dev/null and b/attachments/finger_print_icon_2x.png differ diff --git a/attachments/monthly_digest_subheader_charts_2x.png b/attachments/monthly_digest_subheader_charts_2x.png new file mode 100644 index 0000000..db0b161 Binary files /dev/null and b/attachments/monthly_digest_subheader_charts_2x.png differ diff --git a/attachments/thumbs_down_dislike_2x.png b/attachments/thumbs_down_dislike_2x.png new file mode 100644 index 0000000..62b6254 Binary files /dev/null and b/attachments/thumbs_down_dislike_2x.png differ diff --git a/attachments/thumbs_up_like_2x.png b/attachments/thumbs_up_like_2x.png new file mode 100644 index 0000000..a3a311a Binary files /dev/null and b/attachments/thumbs_up_like_2x.png differ diff --git a/attachments/transparent_square.png b/attachments/transparent_square.png new file mode 100644 index 0000000..909c66d Binary files /dev/null and b/attachments/transparent_square.png differ diff --git a/attachments/viva_connector_image_2x.png b/attachments/viva_connector_image_2x.png new file mode 100644 index 0000000..e8a6bf5 Binary files /dev/null and b/attachments/viva_connector_image_2x.png differ diff --git a/attachments/viva_insights_charts_2x.png b/attachments/viva_insights_charts_2x.png new file mode 100644 index 0000000..be33624 Binary files /dev/null and b/attachments/viva_insights_charts_2x.png differ diff --git a/attachments/viva_insights_dashboard_2x.png b/attachments/viva_insights_dashboard_2x.png new file mode 100644 index 0000000..259ea7e Binary files /dev/null and b/attachments/viva_insights_dashboard_2x.png differ diff --git a/attachments/viva_insights_digest_2x.png b/attachments/viva_insights_digest_2x.png new file mode 100644 index 0000000..26de269 Binary files /dev/null and b/attachments/viva_insights_digest_2x.png differ diff --git a/attachments/viva_insights_finger_print_icon_fre_2x.png b/attachments/viva_insights_finger_print_icon_fre_2x.png new file mode 100644 index 0000000..1454391 Binary files /dev/null and b/attachments/viva_insights_finger_print_icon_fre_2x.png differ diff --git a/attachments/viva_insights_mail_unsubscribe_2x.png b/attachments/viva_insights_mail_unsubscribe_2x.png new file mode 100644 index 0000000..e0a5e36 Binary files /dev/null and b/attachments/viva_insights_mail_unsubscribe_2x.png differ diff --git a/attachments/viva_insights_outlook_addin_2x.png b/attachments/viva_insights_outlook_addin_2x.png new file mode 100644 index 0000000..faa830d Binary files /dev/null and b/attachments/viva_insights_outlook_addin_2x.png differ diff --git a/attachments/welcome_update_work_hours_2x.png b/attachments/welcome_update_work_hours_2x.png new file mode 100644 index 0000000..02d7a83 Binary files /dev/null and b/attachments/welcome_update_work_hours_2x.png differ diff --git a/conda.yaml b/conda.yaml index e5e2b85..ce4d60b 100644 --- a/conda.yaml +++ b/conda.yaml @@ -7,9 +7,24 @@ dependencies: # If available, always prefer the conda version of a package, installation will be faster and more efficient. # https://anaconda.org/search - python=3.9.7 - + - nodejs=16.13.0 - pip=20.1 + - pip: # Define pip packages here. # https://pypi.org/ - rpaframework==12.2.0 # https://rpaframework.org/releasenotes.html + - rpaframework-recognition==1.0.0 + - rpaframework-windows==2.0.0 + - rpaframework-google==2.0.0 + - robotframework-browser==11.1.1 + - robotframework-camunda==2.0.0 + - PyMuPDF==1.19.3 + - pytesseract==0.3.8 + - opencv-python==4.5.5.62 + - numpy==1.21.5 + - pywin32==301 + - playwright==1.17.2 + +rccPostInstall: + - rfbrowser init diff --git a/documents/Generali-page21.pdf b/documents/Generali-page21.pdf new file mode 100644 index 0000000..7a596c6 Binary files /dev/null and b/documents/Generali-page21.pdf differ diff --git a/documents/persons.xlsx b/documents/persons.xlsx new file mode 100644 index 0000000..1c3e523 Binary files /dev/null and b/documents/persons.xlsx differ diff --git a/libraries/MyLibrary.py b/libraries/MyLibrary.py deleted file mode 100644 index 5f993ee..0000000 --- a/libraries/MyLibrary.py +++ /dev/null @@ -1,8 +0,0 @@ -from robot.api import logger - - -class MyLibrary: - """Give this library a proper name and document it.""" - - def example_python_keyword(self): - logger.info("This is Python!") diff --git a/libraries/emailer.py b/libraries/emailer.py new file mode 100644 index 0000000..28d6912 --- /dev/null +++ b/libraries/emailer.py @@ -0,0 +1,47 @@ +from RPA.Email.ImapSmtp import ImapSmtp +from RPA.Outlook.Application import Application +from RPA.Robocorp.Vault import Vault +import time + +def send_gmail_email(recipient, subject, body): + secret = Vault().get_secret("emailGmailCredentials") + gmail_account = secret["username"] + gmail_password = secret["password"] + mail = ImapSmtp(smtp_server="smtp.gmail.com", smtp_port=587) + mail.authorize(account=gmail_account, password=gmail_password) + mail.send_message( + sender=gmail_account, + recipients=recipient, + subject=subject, + body=body, + ) + +def send_outlook_email(recipient, subject, body): + app = Application() + app.open_application() + try: + app.send_email(recipients=recipient, subject=subject, body=body) + except Exception as e: + if e.strerror == 'Call was rejected by callee.': + time.sleep(2) + app.send_email(recipients=recipient, subject=subject, body=body) + +def get_outlook_email(account_name,folder_name): + app = Application() + app.open_application() + time.sleep(2) + email_list = app.get_emails(account_name=account_name, folder_name=folder_name, save_attachments=True, attachment_folder="D:\\RobotFramework\\attachments\\") + return email_list + +# def send_outlook_email(recipient, subject, body): +# secret = Vault().get_secret("emailOutlookCredentials") +# outlook_account = secret["username"] +# outlook_password = secret["password"] +# mail = ImapSmtp(smtp_server="smtp.office365.com", smtp_port=587) #should enable smtp access in Exchange +# mail.authorize(account=outlook_account, password=outlook_password) +# mail.send_message( +# sender=outlook_account, +# recipients=recipient, +# subject=subject, +# body=body, +# ) \ No newline at end of file diff --git a/libraries/exceler.py b/libraries/exceler.py new file mode 100644 index 0000000..957b8f7 --- /dev/null +++ b/libraries/exceler.py @@ -0,0 +1,20 @@ +import os +from RPA.Excel.Files import Files +from RPA.Tables import Tables + +# FILE_EXCEL_PATH = os.environ[""] + +excel = Files() +tables = Tables() + +# def get_filtered_excel(excel_path): +# excel = read_excel_as_table(excel_path) +# tables.filter_table_by_column(excel, "", "==", "") +# return excel + +def read_excel_as_table(excel_path): + try: + excel.open_workbook(excel_path) + return excel.read_worksheet_as_table(header=True) + finally: + excel.close_workbook() \ No newline at end of file diff --git a/libraries/pdfer.py b/libraries/pdfer.py new file mode 100644 index 0000000..3f30bc2 --- /dev/null +++ b/libraries/pdfer.py @@ -0,0 +1,41 @@ +import fitz +from RPA.Tables import Tables +from RPA.PDF import PDF + + +def get_pdf_widgets(): + + table = Tables() + filename = "documents/Generali-page21.pdf" + doc = fitz.open(filename) + page = doc.load_page(0) + + columns_list = ['field_name','field_label','field_value'] + mytable = table.create_table(None, False, columns_list) + + # table.add_table_column(mytable, "field_name") + # table.add_table_column(mytable,"field_label") + # table.add_table_column("field_value") + + list_values=[] + for field in page.widgets(): + list_values.append(field.field_name) + list_values.append(field.field_label) + list_values.append(field.field_value) + table.add_table_row(mytable, list_values) + list_values=[] + # print("field name : %s **** field label : %s **** field value : %s" %(field.field_name,field.field_label,field.field_value)) + + rows, columns = mytable.dimensions + print(rows,columns) + for i in range(1, rows): + row = mytable.get_row(i) + print(row["field_name"] + " *** " + row["field_label"] + " *** " + row["field_value"]) + #table.group_by_column + + +def get_pdf_fields(): + pdf = PDF() + fields = pdf.get_input_fields("documents/Generali-page21.pdf") + print(fields) + diff --git a/libraries/tasks.py b/libraries/tasks.py new file mode 100644 index 0000000..b170be2 --- /dev/null +++ b/libraries/tasks.py @@ -0,0 +1,88 @@ +from exceler import read_excel_as_table +from RPA.Tables import Tables +from variables import today +import emailer + +from RPA.Browser.Selenium import Selenium +from RPA.Robocorp.Vault import Vault +from robot.api import logger + +import logging +import sys + +from playwright.sync_api import sync_playwright + +stdout = logging.StreamHandler(sys.stdout) + +logging.basicConfig( + level=logging.INFO, + format="[{%(filename)s:%(lineno)d} %(levelname)s - %(message)s", + handlers=[stdout], +) + +lib = Selenium() + + +secret = Vault().get_secret("credentials") + +username = secret["username"] #"aidemobot@gmail.com" +password = secret["password"] # "Dasilva2010" + +def connect_to_sangoma(): + lib.open_available_browser("https://portal.sangoma.com/") + lib.input_text("id:email_address", username) + lib.input_text("id:password", password) + lib.click_button("css=button[class=\"btn btn-primary btn-block\"]") + selected_option = "//span[text()='Users/Customers']" + lib.wait_until_element_is_visible(selected_option) # must read doc + lib.click_element(selected_option) # must read doc + selected_option = "//a[text()='List Users']" + lib.click_element(selected_option) + import time + time.sleep(5) + logger.info("Connection to Sangoma has been completed.", html=True) + +def connect_with_playwright(): + with sync_playwright() as p: + for browser_type in [p.chromium]: + browser = browser_type.launch() + page = browser.new_page() + page.goto('http://whatsmyuseragent.org/') + page.screenshot(path=f'my-browser-specs-{browser_type.name}.png') + browser.close() + +def email_to_send(): + receiver_name = "Ali" + name = f"{receiver_name}" + recipient = "aidemobot@gmail.com" + subject = "This a Robot speaking to Ali!" + body = ( + f"Hi, {name}! " + f"Remember that you have to finish your wonderful robot and get it up and running on {today()}." + ) + emailer.send_outlook_email(recipient, subject, body) + +def get_outlook_emails(): + account_name = "ali.belcaid@datapiens.com" + folder_name = "Inbox" + emails = emailer.get_outlook_email(account_name,folder_name) + for email in emails: + #print(email) + print(email["Sender"] + " **** " + email["Subject"]) + +def read_from_excel(): + table = Tables() + path = "D:\\RobotFramework\\documents\\persons.xlsx" + table = read_excel_as_table(path) + rows, columns = table.dimensions + print(rows,columns) + for i in range(1, rows): + row = table.get_row(i) + print(row["Name"] + " *** " + row["email"] + " *** " + row["Location"]) + table.group_by_column + +if __name__ == "__main__": + LOGGER = logging.getLogger(__name__) + #connect_to_sangoma() + #email_to_send() + diff --git a/log.html b/log.html index a3fa7ad..0137878 100644 --- a/log.html +++ b/log.html @@ -1799,31 +1799,31 @@ window.output = {}; diff --git a/output.xml b/output.xml index bc1f90c..4db90be 100644 --- a/output.xml +++ b/output.xml @@ -1,34 +1,14 @@ - + - - -Creating an instance of the Chrome WebDriver. -Created download root directory: C:\Users\albel\AppData\Local\robocorp\webdrivers -Created symlink directory: C:\Users\albel\AppData\Local\robocorp\webdrivers -Creating an instance of the Chrome WebDriver. -Created Chrome browser with arguments: --disable-dev-shm-usage --disable-web-security --allow-running-insecure-content --no-sandbox -<p>Attempted combinations:</p><div class="doc"><table><tr><th>Browser</th><th>Download</th><th>Error</th></tr><tr><td>Chrome</td><td>False</td><td>Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home -</td></tr><tr><td>Chrome</td><td>True</td><td></td></tr></table></div> -Opening url 'https://portal.sangoma.com/' -Typing text 'aidemobot@gmail.com' into text field 'id:email_address'. -Typing text 'Dasilva2010' into text field 'id:password'. -Clicking button 'css=button[class="btn btn-primary btn-block"]'. -Clicking element '//span[text()='Users/Customers']'. -Clicking element '//a[text()='List Users']'. -Connection to Sangoma has been completed. - + + + - -${TODAY} -Logs the given message with the given level. -2021-12-27 18:08:50.508610 - - - + -Robot that connect to Sangoma website. - +Robot that do a lot of things + diff --git a/report.html b/report.html index 7765be2..69260e9 100644 --- a/report.html +++ b/report.html @@ -1628,22 +1628,22 @@ window.output = {};