views:

87

answers:

2

Hey guys, I am using Selenium RC to do some test now. And the driver I use is python. But now, I faced a problem, that is: every time Selenium RC runs, and open a url, it opens 2 windows, one is for logging and the other one is for showing HTML content. But I can't close them all in script.

here's my script:

#!/usr/bin/env python
#-*-coding:utf-8-*-
from selenium import selenium

def main():
    sel = selenium('localhost', 4444, '*firefox', 'http://www.sina.com.cn/')
    sel.start()
    try:
        sel.open('http://www.sina.com.cn/')
    except Exception, e:
        print e
    else:
        print sel.get_title()
    sel.close()
    sel.stop()

if __name__ == '__main__':
    main()

It's very easy to understand. What I really want is to close all windows that selenium opens. I've tried close() and stop(), but they all don't work.

A: 

I may suggest to make a system command with python to close the firefox windows

Bussiere

+1  A: 

I've fix this problem. It happens because I installed firefox-bin not firefox. Now I've removed firefox-bin and have installed firefox, it works now. stop() will close all windows that selenium opened.

Thank you for your reminds AutomatedTester

davidx