Using Selenium IDE with random values

前端 未结 12 1876
囚心锁ツ
囚心锁ツ 2020-12-04 07:49

Is it possible to create Selenium tests using the Firefox plugin that use randomly generated values to help do regression tests?

The full story: I w

12条回答
  •  情话喂你
    2020-12-04 08:19

    First off, the Selenium IDE is rather limited, you should consider switching to Selenium RC, which can be driven by Java or Perl or Ruby or some other languages.

    Using just Selenium IDE, you can embed JavaScript expressions to derive command parameters. You should be able to type a random number into a text field, for example:

    type fieldName javascript{Math.floor(Math.random()*11)}
    

    Update: You can define helper functions in a file called "user-extensions.js". See the Selenium Reference.

提交回复
热议问题