Scripting FAQ

Here you can find common problems that you may encounter when using our Scripting Engine.

  • I am unable to login to a website when I enter my credentials (text fields are not activated).

    Assuming that you have entered the correct credentials you may need to add some extra code after the type command.

    type("""username_css_selector""", """my_username""")
    type("""password_css_selector""", """my_password""")
    runScript("""
    document.querySelector("username_css_selector").dispatchEvent(new Event("change"))
    document.querySelector("password_css_selector").dispatchEvent(new Event("change")) 
    """)
    pause(1)
    click("""login_button_css_selector""")

    If the above does not work and you notice the keyword “react” or ” reactApplication ” in the source, use the following:

    React login form

    runScript("""
    target1 = document.querySelector('email_css_selector')
    target1.value='my_username@email.com'
    var event = document.createEvent("HTMLEvents"); 
    event.initEvent("input", true, true);
    target1.dispatchEvent(event);
    
    target2 = document.querySelector('password_css_selector')
    target2.value='my_password'
    var event = document.createEvent("HTMLEvents"); 
    event.initEvent("input", true, true);
    target2.dispatchEvent(event);
    
    document.querySelector("login_button_css_selector").click()
    """)

    Some dashboards may require the following script:

    type("""email_css_selector""", """email""")
    type("""password_css_selector""", """password""")
    runScript("""
    document.querySelector('email_css_selector').dispatchEvent(new Event("input", { bubbles: true }))
    document.querySelector('password_css_selector').dispatchEvent(new Event("input", { bubbles: true }))
    """)
    pause(1)
    clickAndWait("""login_button_css_selector""")