Skip to content

Files

Latest commit

3420665 · Dec 23, 2023

History

History
37 lines (31 loc) · 1.72 KB

File metadata and controls

37 lines (31 loc) · 1.72 KB

A robot that completes the customer onboarding challenge

crm

This example robot completes the customer onboarding challenge at https://developer.automationanywhere.com/challenges/automationanywherelabs-customeronboarding.html.

The robot uses the robocorp-playwright library for browser automation, RPA.HTTP library for downloading the CSV file used in the challenge and the Polars library for reading the CSV into a table data structure.

@task
def solve_challenge():
    """Solve the RPA challenge"""
    browser.configure(
        browser_engine="chromium",
        screenshot="only-on-failure",
        headless=True,
    )
    # user_agent is neede for headless runs
    user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
    context = browser.context()
    context.set_extra_http_headers({"User-Agent": user_agent})
    # navigate to challenge page
    browser.goto(URL)
    # get customer data as dataframe
    df_customers = get_customers_data()
    # fill data to crm
    for customer in df_customers.rows(named=True):
        fill_and_submit_form(customer)
    # log screenshot and challlenge id
    challenge_verification()

For more information, do not forget to checkout the following: