droidbot icon indicating copy to clipboard operation
droidbot copied to clipboard

AttributeError: 'NoneType' object has no attribute 'policy'

Open Rain0193 opened this issue 5 years ago • 4 comments

when I use -script start: { "views": { "login_phone": { "resource_id": "com.taihe.jokerxue:id/et_phone_num", "class": "android.widget.EditText" }, "get_verification": { "resource_id": "com.taihe.jokerxue:id/tv_get_verification", "class": "android.widget.TextView" }, "send_verification": { "resource_id": "com.taihe.jokerxue:id/et_verification", "class": "android.widget.EditText" }, "login_button": { "resource_id": "com.taihe.jokerxue:id/btn_enter", "class": "android.widget.Button" } }, "states": { "login_state": { "views": ["login_phone", "get_verification", "send_verification", "login_button"] } }, "operations": { "login_operation": [ { "event_type": "set_text", "target_view": "login_phone", "text": "12608001103" }, { "event_type": "touch", "target_view": "get_verification" }, { "event_type": "set_text", "target_view": "send_verification", "text": "1234" }, { "event_type": "touch", "target_view": "login_button" }, { "event_type": "exit" } ] }, "main": { "login_state": ["login_operation"] } } ScriptSyntaxError: ViewSelector.class: type should be <type 'str'>, <type 'unicode'> given [CONNECTION] ADB is disconnected [CONNECTION] DroidBotIme is disconnected Traceback (most recent call last): File "/usr/local/bin/droidbot", line 11, in load_entry_point('droidbot', 'console_scripts', 'droidbot')() File "/Users/taiheminione/Public/droidbot/droidbot/start.py", line 168, in main replay_output=opts.replay_output) File "/Users/taiheminione/Public/droidbot/droidbot/droidbot.py", line 116, in init self.stop() File "/Users/taiheminione/Public/droidbot/droidbot/droidbot.py", line 191, in stop if hasattr(self.input_manager.policy, "master") and
AttributeError: 'NoneType' object has no attribute 'policy'

Rain0193 avatar May 21 '19 08:05 Rain0193

Looks like a typical encoding error. Will take a look soon.

yuanchun-li avatar May 24 '19 01:05 yuanchun-li

Hi @Rain0193 , please share your origin script file with us.

yzygitzh avatar May 24 '19 14:05 yzygitzh

Hi @Rain0193 , please share your origin script file with us.

{
    "views": {
        "login_phone": {
            "resource_id": "com.taihe.jokerxue:id/et_phone_num",
            "class": "android.widget.EditText"
        },
        "get_verification": {
            "resource_id": "com.taihe.jokerxue:id/tv_get_verification",
            "class": "android.widget.TextView"
        },
		"send_verification": {
			"resource_id": "com.taihe.jokerxue:id/et_verification",
			"class": "android.widget.EditText"
		},
        "login_button": {
            "resource_id": "com.taihe.jokerxue:id/btn_enter",
            "class": "android.widget.Button"
        }
    },
    "states": {
        "login_state": {
            "views": ["login_phone", "get_verification", "send_verification", "login_button"]
        }
    },
    "operations": {
        "login_operation": [
            {
                "event_type": "set_text",
                "target_view": "login_phone",
                "text": "12608001103"
            },
            {
                "event_type": "touch",
                "target_view": "get_verification"
            },
			{
				"event_type": "set_text",
				"target_view": "send_verification",
				"text": "1234"
			},
            {
                "event_type": "touch",
                "target_view": "login_button"
            },
            {
                "event_type": "exit"
            }
        ]
    },
    "main": {
        "login_state": ["login_operation"]
    }
}

Rain0193 avatar May 28 '19 07:05 Rain0193

Having similar issue with the following script : { "views": { "sign_up_button":{ "resource_id": "com.punchh.fazolis:id/HomeScreen_B_SignUp", "class": "android.widget.Button" }

},
"states": {
    "home_state": {
        "activity": "com.punchh.fazolis.CustomHomeActivity",
        "views": ["sign_up_button"]
    }
},
"operations": {
    "home_operation": [
        {
            "event_type": "touch",
            "target_view": "sign_up_button"
        }
    ]
},
"main": {
    "home_state": ["home_operation"]
}

}

sujon335 avatar Aug 06 '19 16:08 sujon335