# Here are three examples of solution.
# Task: "Aliquet. Sollicitudin nam lectus." is my reply to Brittani's most recent email / Find the email by Brittani and reply to them with the text "Aliquet. Sollicitudin nam lectus.".
def solution(agent, start_from=1):
# General plan: I should first click on the email by Brittani, then click on the reply button, then type the text "Aliquet. Sollicitudin nam lectus." and finally click on the send button.
    if start_from <= 1:
        print('[Step 1] click on the email by Brittani')
        agent.click_xpath("//div[@class='email-sender' and text()='Brittani']")
        state_after_interaction = agent.click_xpath("//span[@class='email-reply']")
        # the reply content should be displayed on page.
        assert 'reply-text' in state_after_interaction, 'I cannot do [Step 1] correctly. The reply button is not displayed on the page.'
    
    if start_from <= 2:
        print('[Step 2] type the text "Aliquet. Sollicitudin nam lectus."')
        agent.click_xpath("//textarea[@id='reply-text']")
        agent.type('Aliquet. Sollicitudin nam lectus.')
        state_after_interaction = agent.click_xpath("//*[@id='send-reply']")

# Task: Find the last email by Blanca and send it to Agathe / Find the email by Blanca and forward that email to Agathe.
def solution(agent, start_from=1):
# General plan: I should first click on the email by Blanca, then click on the forward button, then type "Agathe" and finally click on the send button.
    if start_from <= 1:
        print('[Step 1] click on the email by Blanca')
        agent.click_xpath("//div[@class='email-sender' and text()='Blanca']")
        state_after_interaction = agent.click_xpath("//span[@class='email-forward']")
        # the forward content should be displayed on page.
        assert 'forward-sender' in state_after_interaction, 'I cannot do [Step 1] correctly. The forward button is not displayed on the page.'
    
    if start_from <= 2:
        print('[Step 2] type "Agathe"')
        agent.click_xpath("//input[@class='forward-sender']")
        agent.type('Agathe')
        state_after_interaction = agent.click_xpath("//*[@id='send-forward']")
        
# Task: Delete this email from Salli / Please find Salli's email in the inbox and delete it.
def solution(agent, start_from=1):
# General plan: I should first click on the email by Salli, then click on the trash icon.
    if start_from <= 1:
        print('[Step 1] click on the email by Salli')
        agent.click_xpath("//div[@class='email-sender' and text()='Salli']")
        agent.click_xpath("//span[@class='trash']")