Tuesday 30 August 2011

Handling Browser Security


Handling Browser Security –
1)  Handle FireFox Security
Method-1:
·         Run the selenium test
·         Select "Accept this certificate permanently" when prompted by popup
·         Click on the OK button
·         Open Windows Explorer and navigate to => "C:\Users\xxxxxxxx\AppData\Local\Temp\customProfileDirxxxx"
·         This is a temparary profile created by Firefox which contains a file called "cert_override.txt"
·         Copy "cert_override.txt" to your temp directory
·         Stop your selenium server.
·         Open your "selenium-server.jar" file from "c:\selenium-remote-control-xxx\selenium-server-xxx" using WinRar
·         Drag "cert_override.txt" file into the "selenium-server.jar\customProfileDirCUSTFFCHROME" folder in WinRar (do not delete or edit anything in the .jar file)
·         Close WinRar, start selenium and try it again :)
Method-2:
·         Navigate your application in firefox.
·         Select "Accept this certificate permanently" when prompted by popup.
·         Copy "cert_override.txt" and "cert8.db" to your temp directory.
·         Create a new directory in any drive. Ex – C:\FFProfile. Paste the above two files under this.
·         Now run the selenium server with below option – java -jar selenium-server-standalone-2.3.0.jar –firefoxprofile C:\FFProfile
·         Now it will not show the certificate screen.

2)  Handle IE7 Security
-- Use the below code in your script
if (brw.is_text_present("Continue to this website (not recommended).")):
        brw.click("link=Continue to this website (not recommended).")
        time.sleep(10)

6 comments:

  1. That was nicely put useful information.
    Now, I am working on automating a web page and at the same time read some data from it, simultaneously. The web page has frames for which I use switch_to_frame method. In this case the driver instance focuses on that frame alone. Is there any way where we can work on two different frames together doing different things, its like I need two driver instances for the same browser?

    ReplyDelete
  2. I did not come across this situation. However as per document, we can not have more than one instance for same browser. Please see below comment -
    Q: Can I run multiple instances of the WebDriver sub-classes?

    A: Each instance of an HtmlUnitDriver, ChromeDriver and FirefoxDriver is completely independent of every other instance (in the case of firefox and chrome, each instance has its own anonymous profile it uses). Because of the way that Windows works, there should only ever be a single InternetExplorerDriver instance at one time. If you need to run more than one instance of the InternetExplorerDriver at a time, consider using the Remote!WebDriver and virtual machines.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hi
    How to Select certificate from windows security pop-up after clicking on Continue to this website (not recommended). in IE8 on windows 7

    ReplyDelete
  5. Hi,
    What are the frameworks are available for python selenium.
    Can you explain one framework detailed.
    Thank you.

    ReplyDelete
  6. A nice article here, i think that people who have grown up with the idea of using computers are showing more responsibility towards writing posts that are thoughtful, do not have grammar mistakes and pertinent to the post..

    Selenium Training in Chennai

    ReplyDelete