最新版selenium元素定位
时间: 2023-09-11 10:04:33 浏览: 116
最新版的selenium元素定位可以使用以下语法:
element_class_head = driver.find_elements(By.CLASS_NAME,"head")
这是使用By类的CLASS_NAME方法来定位元素,其中"head"是要定位的元素的类名。通过使用这种方式,可以避免使用过时的定位方法,如find_element_by_class_name("head")。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [新版selenium定位全部相同class的元素或定位第二个元素的方法](https://blog.csdn.net/zzzzzzzrr/article/details/127846792)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Python爬虫(1)一次性搞定Selenium(新版)8种find_element元素定位方式](https://blog.csdn.net/qq_16519957/article/details/128740502)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文