Google form automation

I was trying to automate a google form submit by robofraework RPA.I have this google form
Google Form Automation I am using the below keyword to set the value

*** Keywords ***
Set Value By Xpath
    [Arguments]    ${xpath}    ${value}
    ${result}=    Execute Javascript    document.evaluate('${xpath}',document.body,null,9,null).singleNodeValue.value='${value}';
    [Return]    ${result}
*** Keywords ***
Fill And Submit The Form
    [Arguments]    ${workload}
    Set Value By Xpath    //*[@id="mG61Hd"]/div[2]/div/div[2]/div[1]/div/div/div[2]/div/div[1]/div/div[1]/input    ${workload}[test_file]
    click element  //*[@id="mG61Hd"]/div[2]/div/div[3]/div[1]/div/div/span/span

and from a another task I am calling Fill And Submit The Form but it is not working . Actually it is not seeting value in the data-initial-value of the google form text . How can I do that ?

I belive this is getting answered in Slack

2 Likes

Pasting Raivo’s example from Slack here so that it is easier to find:

*** Settings ***
Documentation   Template robot main suite.
Library                 RPA.Browser
Suite Teardown          Close Browser

*** Tasks ***
Test
    Open Available Browser      https://docs.google.com/forms/d/e/1FAIpQLSeOISHP5gfOwwr7zLn8dPAxbx8V_8P8dztnMjv1PCUGa9ERkg/viewform
    Click Element When Visible   //div[1]//div[1]//div[1]//div[2]//div[1]//div[1]//div[1]//div[1]//input[1]
    Input Text    //div[1]//div[1]//div[1]//div[2]//div[1]//div[1]//div[1]//div[1]//input[1]    Test
    Input Text    //div[@role='list']//div[2]//div[1]//div[1]//div[2]//div[1]//div[1]//div[1]//div[1]//input[1]    Test
    Input Text    //div[3]//div[1]//div[1]//div[2]//div[1]//div[1]//div[1]//div[1]//input[1]    Test
    Input Text    //div[4]//div[1]//div[1]//div[2]//div[1]//div[1]//div[1]//div[1]//input[1]    Test
    #Submit Form
    Sleep   10s