【发布时间】:2021-06-28 14:26:39
【问题描述】:
我有这个错误 selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="channel-icon-wrapper-2eYxZ"]"}
这里是代码
connexion_bar = driver.find_element_by_name("channel-icon-wrapper-2eYxZ")
这里是代码 HTML <div class="channel-name-2qzLW">Utiliser téléphone/e-mail/nom d'utilisateur</div>
我尝试将connexion_bar = driver.find_element_by_name("channel-icon-wrapper-2eYxZ") 替换为connexion_bar = driver.find_element_by_class_name("channel-icon-wrapper-2eYxZ"),但出现相同的错误消息:/
【问题讨论】:
-
当您的 HTML 甚至不包含该字符串时,为什么还要坚持按名称或按类别搜索
channel-icon-wrapper-2eYxZ?
标签: python selenium xpath css-selectors webdriver