Emulating user browsing session for unit test
I'm searching for a framework that could allow me to emulate user browsing session.
A typical session looks like:
- Browse to home page, get session
- Be redirected to current page
- Click on some link
- Get connected
- Submit a form
- and co...
I would like to be able to define this session using API calls.
What frameworks would you recommend to be able to run this setup? It shoul开发者_高级运维d be run headless (not inside the browser), to be able to execute via Hudson.
Language does not matter, python of java would be great.
Thank you,
Maxim.There are multiple frameworks which can do this. Check out:
https://github.com/axefrog/XBrowser
http://htmlunit.sourceforge.net/
and the answer to this question: Alternative to HtmlUnit
Have a look at htmlunit
Its even got decent javascript support, its Java based.
- Support for the HTTP and HTTPS protocols
- Support for cookies
- Ability to specify whether failing responses from the server should throw exceptions or should be returned as pages of the appropriate type (based on content type)
- Support for submit methods POST and GET (as well as HEAD, DELETE, ...)
- Ability to customize the request headers being sent to the server
- Support for HTML responses
- Wrapper for HTML pages that provides easy access to all information contained inside them
- Support for submitting forms
- Support for clicking links
- Support for walking the DOM model of the HTML document
- Proxy server support
- Support for basic and NTLM authentication
- Excellent JavaScript support
take a look at Selenium WebDriver with Xvfb.
this post shows an example in Python:
'Python - Headless Selenium WebDriver Tests using PyVirtualDisplay'
精彩评论