当前位置:网站首页>Error "list" object is not callable in Web automatic switching window
Error "list" object is not callable in Web automatic switching window
2022-07-02 06:33:00 【bthtth】
# Repack switch_to.window
def is_open_new_window(self,current_handles) # Parameter name and new_window_is_opened Duplicate formal parameters of
"""
Check whether a new window opens , Switch to a new window if there is one
"""
if EC.new_window_is_opened(all_handles):
self.driver.switch_to.window(self.driver.window_handles[-1])
# To write page object
def to_new_page(self):
""" Click button , Jump to a new page """
WebDriverWait(self.driver).until(EC.visiblity_of_element_located((By.ID,index.list_fc))
window_handles = self.driver.window_handles
# window_handles and window_handles() repeat
self.click(index.list_fc)
self.is_open_new_window(handles_index) # Call the repackaged method
The above is the error code , Rewritten by impression , Can't emersion , For reference only .
The solution is , Check variable name , Whether the method name is related to the variable , Method , Duplicate formal parameter name
The modified code
# Repack switch_to.window
def is_open_new_window(self,all_handles)
"""
Check whether a new window opens , Switch to a new window if there is one
"""
if EC.new_window_is_opened(all_handles): # The argument is named all_handles
self.driver.switch_to.window(self.driver.window_handles[-1])
# To write page object
def to_new_page(self):
""" Click button , Jump to a new page """
WebDriverWait(self.driver).until(EC.visiblity_of_element_located((By.ID,index.list_fc))
handles_index = self.driver.window_handles # Revised window_handles, and window_handles The method has the same name
self.click(index.list_fc)
self.is_open_new_window(handles_index)
# Report errors "list" object is not callable
边栏推荐
- Kotlin - 验证时间格式是否是 yyyy-MM-dd HH:mm:ss
- Data science [viii]: SVD (I)
- 找到页面当前元素z-index最高的数值
- 标签属性disabled selected checked等布尔类型赋值不生效?
- CUDA中的存储空间修饰符
- ctf-web之练习赛
- Support new and old imperial CMS collection and warehousing tutorials
- Redis - cluster data distribution algorithm & hash slot
- 利用传统方法(N-gram,HMM等)、神经网络方法(CNN,LSTM等)和预训练方法(Bert等)的中文分词任务实现
- Summary of WLAN related knowledge points
猜你喜欢
随机推荐
Codeforces Round #797 (Div. 3) A—E
Distributed transactions: the final consistency scheme of reliable messages
Does the assignment of Boolean types such as tag attribute disabled selected checked not take effect?
注解和反射详解以及运用
TensorRT的命令行程序
pytest(3)parametrize参数化
Shardingsphere JDBC
web自动中利用win32上传附件
记录一次RDS故障排除--RDS容量徒增
Function execution space specifier in CUDA
深入了解JUC并发(二)并发理论
链表(线性结构)
PgSQL学习笔记
Loops in tensorrt
Golang--map扩容机制(含源码)
selenium+msedgedriver+edge浏览器安装驱动的坑
Amazon AWS data Lake Work Pit 1
Find the highest value of the current element Z-index of the page
CUDA中的存储空间修饰符
Linear DP (split)