您的位置:首页 > 产品设计 > UI/UE

关于Selenium的close()与quit()的区别

2020-04-01 18:35 846 查看

源码

def close(self):
"""
Closes the current window.

:Usage:
driver.close()
"""
self.execute(Command.CLOSE)

def quit(self):
"""
Quits the driver and closes every associated window.

:Usage:
driver.quit()
"""
try:
self.execute(Command.QUIT)
finally:
self.stop_client()

通过查看源码我们一目了然:

close()
方法是指退出当前窗口
quit()
是直接退出浏览器并关闭所有相关窗口。**finally: self.stop_client()**这行代码说明
quit()
很硬。

  • 点赞
  • 收藏
  • 分享
  • 文章举报
傻子丶疯子 发布了10 篇原创文章 · 获赞 0 · 访问量 533 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: