How to disable Javascript when using Selenium?

前端 未结 16 706
星月不相逢
星月不相逢 2020-12-05 05:07

I am wondering how do I disable javascript when using selenium so I can test server side validation.

I found this article but I don\'t know what to really do. Like I

16条回答
  •  萌比男神i
    2020-12-05 05:39

    The steps to use the script referenced above aren't to bad:

    1. Create the selenium "user-extensions.js" file as mentioned in the article you link.
    2. Select your "user-extensions.js" file in the Selenium preferences in Options->Options.
    3. Use the script by selecting the command "DisableJavascript" or "EnableJavascript" from the command list (or just type it manually).

    For screen shot examples of steps 2 and 3 see: http://i32.tinypic.com/161mgcm.jpg

    Update: For information about using user-extensions.js with Selenium RC try the following URL: http://seleniumhq.org/docs/08_user_extensions.html

提交回复
热议问题