Python 3.x 如何使用Selenium(python)引用此元素?

Python 3.x 如何使用Selenium(python)引用此元素?,python-3.x,selenium-chromedriver,Python 3.x,Selenium Chromedriver,因此,我试图自动化这个简单的事情,我想点击一个图像。 以下是HTML: <div class="guild-inner" draggable="false" style="border-radius: 15px;"> <a draggable="false" class="avatar-small" href="/channels/223259649967652887/381675339702599690" style="background-image: url(&q

因此,我试图自动化这个简单的事情,我想点击一个图像。 以下是HTML:

<div class="guild-inner" draggable="false" style="border-radius: 15px;">
<a draggable="false" class="avatar-small" href="/channels/223259649967652887/381675339702599690" style="background-image: url(&quot;https://cdn.discordapp.com/icons/223259649967652887/2be8d9ec8759056fabe8caa306c632c8.png&quot;);">
</a>
</div>
以下是错误:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//a[href="/channels/223259649967652887/381675339702599690"]"}

我必须通过href引用这篇文章,因为这是唯一独一无二的东西。所有的图片都是动态定义的,所以我也不能参考图片的编号。提前谢谢!(selenium新手)

好的,问题是我试图在页面未完全加载时查找元素。因此,在开始搜索元素之前,我必须投入大约一分钟的睡眠时间。因为java脚本仍在后台加载。还有什么可以决定页面是否已经完全加载,包括java脚本,而不是随机设置睡眠时间?很高兴学习

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//a[href="/channels/223259649967652887/381675339702599690"]"}