Skip to content

Selenium Cases Support

TTL edited this page Mar 14, 2019 · 2 revisions

Selenium Cases Support

ONLY SUPPORT for VERSION >= HAF-2.6.2

Web UI cases

NOTICE : must have webdriver

start web

using the selenium normal desired_caps to start an url web page

       "desired_caps": {
		"platformName": "chrome",
		"platformVersion": "70",
                "start_url": "www.baidu.com"
	}

test stages

    {
	"id": 1,                                    \\ stage id
	"name": "打开百度",                          \\ stage name
	"operation": "send_keys",                   \\ stage action , support click, swipe, send_keys
	"path": {                                  
		"xpath": "//*[@id='kw']"            \\ to locate the element, support xpath, id, name, ...
	},
	"try": true,                                 \\ try, if true: stage can failed, if false: fast failed case
	"info": {"keys": "autotest.wang"},           \\ info: if `action` is `send_keys", {"keys": "here is the infos"}
	"sleep": 1                                   \\ after action, sleep time
    }

full config

{
   "testcases": [
   {
        "id": 1,
	"name": "test baidu",
	"subid": 1,
	"subname": "default",
	"app_name": "default",
	"run": true,
	"type": "web",
	"wait_time": 2,
	"desired_caps": {
	    "platformName": "chrome",
            "platformVersion": "9",
            "start_url": "http://baidu.com"
	},
	"stage": [
	    {
		"id": 1,
		"name": "输入搜索内容",
		"operation": "send_keys",
		"path": {
			"xpath": "//*[@id='kw']"
		},
		"try": false,
		"info": {"keys": "autotest.wang"},
		"sleep": 0.5
	    },
	    {
		"id": 2,
		"name": "点击搜索按钮",
		"operation": "click",
		"path": {
		    "xpath": "//*[@id='su']"
	        },
	        "try": false,
		"info": null,
		"sleep": 0.5
	    }
	],
	"dependent": null
	}],
	"dbconfig": [{
		"id": 1,
		"sql_name": "mysql1",
		"protocol": "mysql",
		"host": "192.168.41.208",
		"port": 3306,
		"username": "root",
		"password": "testzhan123",
		"database": "visual"
	}],
	"config": [{
		"name": "test_baidu",
		"benchname": "test_baidu",
		"protocol": "http",
		"host_port": "www.baidu.com"
	}]
}