I use Selenium RC for testing. Now to perform a load test, I want to run parallel test cases. Is there any way to run them without opening a browser?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
You can run Selenium headless, take a look at this question/answer: Is it possible to hide the browser in Selenium RC?
Especially for performance load tests, you should have a look at Apache JMeter.
Yes. Just install PhantomJS.
Then, change this line:
driver = webdriver.Firefox()
to:
driver = webdriver.PhantomJS()
The rest of your code won't need to be changed and no browser will open.
For debugging purposes, use
driver.save_screenshot('screen.png')
at different steps of your code or just switch back to Firefox again:Always follow the Documentation. Here is what selenium doc says. It provide a standalone jar.
Download the standalone jar. And run it with command
Now you will see a stanalone server started.
Now set up your webdriver like below and rest part will be as it is.
Summary code will be like.
To set up on Centos (do all installation as root)
Install pip Download https://bootstrap.pypa.io/get-pip.py
Installing selenium If you have pip on your system, you can simply install or upgrade the Python bindings: pip install -U selenium
Alternately, you can download the source distribution from PyPI (e.g. selenium-2.53.1.tar.gz), unarchive it, and run:
install the program: pyvirtualdisplay
Then modify your script to add the bold lines within ** and **
class SeleniumDemo(unittest.TestCase):