I'm crawling with selenium and want to print properties...

Asked 2 years ago, Updated 2 years ago, 47 views

p_elem = driver.find_element_by_xpath("/html[1]/body[1]/div[1]/div[2]/div[1]/div[1]/div[3]/div/img")
data = p_elem.text

print (data)
driver.quit()

I want to print urls, which is the img value of the webtoon div attribute, but only the window turns on and off, and nothing works. I can't find it no matter how much I look for it, and I don't know how to print properties with selenium... Help me

python selenium

2022-09-22 18:18

1 Answers

p_elem.getAttribute("src")

You can obtain attributes by using the getAttribute method for elements received from the find.

Additional

Try find_element_by_xpath instead of find_element_by_xpath that you used in the text.


2022-09-22 18:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.