开发者

Emulating user browsing session for unit test

开发者 https://www.devze.com 2023-02-07 12:25 出处:网络
I\'m searching for a framework that could allow me to emulate user browsing session. A typical session looks like:

I'm searching for a framework that could allow me to emulate user browsing session.

A typical session looks like:

  1. Browse to home page, get session
  2. Be redirected to current page
  3. Click on some link
  4. Get connected
  5. Submit a form
  6. 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'

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号