本最近在学selenium遇到一个东西 不知道是什么
我的selenium版号为4.11.2 python版本为3.11
我的代码为
from selenium import webdrive
from selenium.webdriver.common.by import By
driver = webdriver.Edge()
driver.get("https://www.baidu.com/") # 打开百度
# 4个定位 (定位的时候满足定位条件的元素可能不只一个)
el_1 = driver.find_elements(By.TAG_NAME, "input")
el_2 = driver.find_elements(By.ID, "s_top_wrap")
print(el_1)
#el_1打印结果为
#[<selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_5")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_6")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_7")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_8")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_9")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_10")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_11")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_4")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_12")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_13")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_14")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_15")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_16")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_17")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_18")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_19")>, <selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_20")>]
print(el_2)
#el_2的打印结果为
#<selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_21")>
el_2的打印结果为
<selenium.webdriver.remote.webelement.WebElement (session="590bc5560477c9caa022dae0a3821be9", element="9DCA4E456CD29A98250C25FB368F0361_element_21")>
求告诉我以下问题
①为什么用find_elements()的时候返回的element前面的一串数字一样 例如el_1 el_1的打印结果在代码里 el_1的代码是个列表每个中的element只有前面的一串数字9DCA4E456CD29A98250C25FB368F0361一样后面跟的element_5不一样
②9DCA4E456CD29A98250C25FB368F0361这一串数字代表什么意思
③还有element_21代表的又是什么 如果代表的是网页中出现的顺序那为什么el_2中是从element_21开始的 而不是从element_1开始的
④还有session的具体含义
我也不清楚 求解释下 谢谢