剪裁验证码时,提示nonetype没有location,报错
来源:2-21 设计封装定位元素类

慕勒6533749
2021-07-20
PS E:\selenium> & D:/python/python.exe e:/selenium/selenium/imooc_selenium/register_function.py
Traceback (most recent call last):
File “e:/selenium/selenium/imooc_selenium/register_function.py”, line 72, in
regisetr_funtion.main()
File “e:/selenium/selenium/imooc_selenium/register_function.py”, line 62, in main
code_text = self.code_online(file_name)
File “e:/selenium/selenium/imooc_selenium/register_function.py”, line 48, in code_online
self.get_code_image(file_name)
File “e:/selenium/selenium/imooc_selenium/register_function.py”, line 38, in get_code_image
print(code_element.location)
AttributeError: ‘NoneType’ object has no attribute 'location’
PS E:\selenium>
自己调试代码发现user_name是None
def get_user_element(self,key):
find_element = FindElement(self.driver)
user_element = find_element.get_element(key)
return user_element
1回答
-
Mushishi
2021-07-20
说明你元素没有找到。042021-07-28
相似问题