driver.find_elements_by_tag_name
时间: 2023-09-20 19:10:35 浏览: 146
("tag_name")
This method returns a list of all the web elements on the current page that match the specified HTML tag name. For example, if you call driver.find_elements_by_tag_name("a"), it will return a list of all the anchor tags on the page. You can then iterate through this list to interact with each element as needed.
相关问题
driver.find_elements_by_tag_name('tr')
This line of code finds all the HTML elements with the tag name "tr" on the web page using the Selenium WebDriver. It returns a list of all the elements found with that tag name. "tr" is the tag name for table rows in HTML.
driver.find_elements_by_tag_name('tr') 的写法有哪些
1. 直接使用 driver.find_elements_by_tag_name('tr')。
2. 使用变量存储 tag_name,例如 tag_name = 'tr',再使用 driver.find_elements_by_tag_name(tag_name)。
3. 将 driver 存储在变量中,例如 driver = webdriver.Chrome(),再使用 driver.find_elements_by_tag_name('tr')。
4. 将 find_elements_by_tag_name 存储在变量中,例如 find_elements = driver.find_elements_by_tag_name,再使用 find_elements('tr')。
阅读全文