Reputation: 3
My goal is to scrape the src link within the video tag on this webpage. This is where I am seeing the video tag along with the link which I want.
driver.find_element(By.XPATH, '//video')
driver.find_element(By.TAG_NAME, 'video')
but I got <selenium.webdriver.remote.webelement.WebElement (session="6a5b945439665a2261e0bb7cf4a19c8e", element="127606c2-b043-4b55-b8ff-5456bb39a2c3")>
from which I dont know how to get the src link. I tried to use .text
but it became blank. = $0
right after the end of the video tag, meaning its a [last selected DOM node index]Selenium Duplicate Elements marked with ==$0$0
or console.log($0)
into the console I get the video tag with the link.Upvotes: 0
Views: 141
Reputation: 10460
You can get the source attribute with:
[...]
source = driver.find_element(By.XPATH, '//video').get_attribute('src')
print(source)
[...]
Result in terminal:
blob:https://mplayer.me/d420cb30-ed6e-4772-b169-ed33a5d3ee9f
See Selenium documentation at https://www.selenium.dev/documentation/
Upvotes: 1