To find all second-level div elements, you can modify the XPath expression to select the child div elements of the outer div. Here is the modified code:

div_elements = driver.find_elements(By.XPATH, "//body/div/div")

This will select all div elements that are immediate children of the outer div.

Selenium: How to Get Second-Level Div Elements in Python

原文地址: http://www.cveoy.top/t/topic/lTof 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录