Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取类型错误:“long”类型的对象在使用输入文本关键字robotframework时没有len()_Robotframework - Fatal编程技术网

获取类型错误:“long”类型的对象在使用输入文本关键字robotframework时没有len()

获取类型错误:“long”类型的对象在使用输入文本关键字robotframework时没有len(),robotframework,Robotframework,获取类型错误:“long”类型的对象在使用输入文本关键字robotframework时没有len Input Text id_q searchvalue 文本框可见,并使用id_q找到。但还是会出错 Output: 17:51:57.077 INFO Typing text '45399135' into text field '//input[@id='id_q']' 17:51:57.277 FAIL TypeError: object of type

获取类型错误:“long”类型的对象在使用输入文本关键字robotframework时没有len

Input Text  id_q  searchvalue
文本框可见,并使用id_q找到。但还是会出错

Output:
17:51:57.077    INFO    Typing text '45399135' into text field '//input[@id='id_q']'    
17:51:57.277    FAIL    TypeError: object of type 'long' has no len()
下面是使用-L Debug运行时的stacktrace

18:41:22.896    INFO    Typing text '45398988' into text field  '//input[@id='id_q']'   
18:41:22.896    DEBUG   POST http://127.0.0.1:59465/hub/session/964cb9df-6090-40b3-bb4c-a1e79eab290c/elements {"using": "xpath", "sessionId": "964cb9df-6090-40b3-bb4c-a1e79eab290c", "value": "//input[@id='id_q']"}   
18:41:22.916    DEBUG   Finished Request    
18:41:22.926    DEBUG   POST http://127.0.0.1:59465/hub/session/964cb9df-6090-40b3-bb4c-a1e79eab290c/element/{931d6a04-99cf-4b26-9a45-b541011de684}/clear {"sessionId": "964cb9df-6090-40b3-bb4c-a1e79eab290c", "id": "{931d6a04-99cf-4b26-9a45-b541011de684}"}     
18:41:22.986    DEBUG   Finished Request    
18:41:23.116    FAIL    TypeError: object of type 'long' has no len()   
18:41:23.116    DEBUG   Traceback (most recent call last):
File "<string>", line 2, in input_text
File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.6.0-py2.7.egg\Selenium2Library\keywords\keywordgroup.py", line 12, in _run_on_failure_decorator
return method(*args, **kwargs)
File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.6.0-py2.7.egg\Selenium2Library\keywords\_formelement.py", line 198, in input_text
self._input_text_into_text_field(locator, text)
File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.6.0-py2.7.egg\Selenium2Library\keywords\_formelement.py", line 363, in _input_text_into_text_field
element.send_keys(text)
File "C:\Python27\lib\site-packages\selenium-2.45.0-py2.7.egg\selenium\webdriver\remote\webelement.py", line 316, in send_keys
for i in range(len(val)):
请尝试以下操作:

for i in range(len(str(val)))

如果没有堆栈跟踪,这很难调试。您需要使用-L DEBUG参数运行pybot,然后log.html应该具有堆栈跟踪。包括在这里,它可能会给我们指明正确的方向。@Pekka,请看stacktrace复制于Hi Madhu之上。这超出了我的想象。我唯一的猜测是,在输入文本行之前,45399135可能以某种方式被转换为长类型。您可以尝试通过在输入文本之前添加以下行将其转换回字符串:${searchvalue str}=convert to string${searchvalue}。然后将输入文本行更改为使用${searchvalue str},它在使用Convert to String后工作。谢谢