Using Selenium IDE with random values

前端 未结 12 1882
囚心锁ツ
囚心锁ツ 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:17

    I made a little improvment to the function generateRandomString. When FF crashes, it's good to be able to use the same random number again.

    Basically, it will ask you to enter a string yourself. If you don't enter anything, it will generate it.

    function generateRandomString( length, chars ) { var string=prompt("Please today's random string",''); if (string == '') {for ( var i = 0 ; i < length ; i++ ) string += chars[ Math.floor( Math.random() * chars.length ) ]; return string;} else { return string;} }

提交回复
热议问题