Manual input from user while running selenium IDE script

后端 未结 9 1361
死守一世寂寞
死守一世寂寞 2021-02-05 19:50

can user is able to give manual input while running selenium IDE script? For ex. If there is name field then can we open input box everytime script runs so that user can give hi

相关标签:
9条回答
  • 2021-02-05 19:59

    Just a minor modification to Stephen Binns response. I'm running Selenium IDE 2.5.0 and my test looks like this:

    <tr>
        <td>store</td>
        <td>javascript{prompt(&quot;password&quot;)}</td>
        <td>password</td>
    </tr>
    

    Without the javascript{} it wouldn't prompt.

    0 讨论(0)
  • 2021-02-05 20:00

    You can use the following script to invoke a javascript prompt in order to get the value

    <tr>
        <td>storeEval</td>
        <td>prompt(&quot;Please enter your FirstName&quot;)</td>
        <td>firstName</td>
    </tr>
    

    Then accessing the value is a case of using ${firstName}.

    EDIT: Since Selenium IDE 2.5.0, the script needs to look like this:

    <tr>
        <td>storeEval</td>
        <td>javascript{prompt(&quot;Please enter your FirstName&quot;)}</td>
        <td>firstName</td>
    </tr>
    
    0 讨论(0)
  • 2021-02-05 20:00

    none of the accepted answers worked for me. Here is how I solved it:

    Create new command (at the top to store my variable that I wanted to use in 30 places.)

    • Command: execute script
    • Target: return "Test Iteration #13"
    • Value: VarName

    then in the 30 places I wanted to use that variable. I put this

    • Value: Enter some text into the web input box and my test iteration number is ${VarName}
    0 讨论(0)
  • 2021-02-05 20:05

    In Selenium IDE 2.8.0: Capture the test session entering the login and password. Edit the Command for each and change from "type" to "waitForText" and remove the values in the Value fields previously stored for login and password. Re-run the saved test script from the IDE.

    0 讨论(0)
  • 2021-02-05 20:05

    You could use the technique suggested here which uses the Selenium WebDriver and Java's BufferedReader. I don't think it can be adapted for Selenium IDE, but the technique should work fine with Selenium RC.

    The basic idea is:

    • Issue Selenium commands up to the point where you want to capture user input.
    • Call the following code to capture the user input to a BufferedReader.

      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader.readLine();

    • Continue your Selenium commands

    (Note, if you are using C#, there is a discussion here on how to use Console.In.ReadLine(); instead of BufferedReader).

    0 讨论(0)
  • 2021-02-05 20:06

    The proposed solution works fine for selenium IDE (tested for 2.5)

    <tr>
        <td>store</td>
        <td>javascript{prompt(&quot;password&quot;)}</td>
        <td>password</td>
    </tr>
    
    0 讨论(0)
提交回复
热议问题