【发布时间】:2022-01-26 17:48:54
【问题描述】:
我正在学习如何使用 Selenium。我正在做一些测试,但得到了这个错误:
selenium.common.exceptions.NoSuchElementException:消息:无法定位元素:.layout layout-base
我的代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.common.by import By
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
driver.get("https://page.onstove.com/epicseven/global/list/e7en003?listType=2&direction=latest&page=1")
driver.find_element(By.CLASS_NAME,"layout layout-base")
我尝试使用find_element 查找的源代码。
我做错了什么?
【问题讨论】:
-
也许可以尝试使用睡眠来让网站有时间将所有元素加载到 DOM 中
标签: python selenium xpath css-selectors classname