我正在使用 BrowserStack 在 Python 中运行 Selenium 脚本。请记住,我是 Python 新手,所以也许有一个我没有看到的简单解决方案。
可以看到代码here
当我运行它时,它总是显示以下内容:
如何解决“ResourceWarning: Enable tracemalloc to get the object allocation traceback”错误?我需要安装一些软件包,在设置中启用某些东西,还是..?
正如您在底部看到的那样,测试总是会执行,但这些警告总是会出现。
最佳答案
正如 here 中提到的!
此 ResourceWarning 表示您打开了一个文件,使用了它,但后来忘记关闭该文件。当 Python 注意到文件对象已死时,它会为您关闭它,但这只会在某个未知时间过去后发生。因此,在最近的版本中,Python 在执行此操作时也会打印 ResourceWarning。
关于Python Selenium - ResourceWarning : Enable tracemalloc to get the object allocation traceback,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60945317/