剪裁验证码时,提示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

说明你元素没有找到。
0
4
慕勒6533749
回复
Mushishi
问题已解决
2021-07-28
共4条回复

Selenium3与Python3实战Web自动化测试框架

打破无项目经验、无框架经验瓶颈,实战Web自动化测试框架!

1883 学习 · 1093 问题

查看课程