我查看了所有帖子,但没有得到我想要的解决方案。
browser.find_element_by_xpath("//*/section/main/div/div[3]/article/div[1]/div/div[1]/div[1]/a")
pic = browser.find_elements_by_xpath("//*/section/main/div/div[3]/article/div[1]/div/div[1]/div[1]/a").get(title)
print(title)
这就是我的代码,但我确实需要这样:
<a href="/p/BrDudIUBuNr/"><div class="eLAPa"><div class="KL4Bh"><img class="FFVAD" decoding="auto" sizes="281.671875px" srcset="https://scontent-frx5-1.cdninstagram.com/vp/38a5fdde34937b2b3e4e600da56c46b5/5C0D05B3/t51.2885-15/e15/s150x150/46276509_388170972011907_7609813800358803282_n.jpg 150w,https://scontent-frx5-1.cdninstagram.com/vp/74b222ca252a488bb5eb110347283c3b/5C0CB7F9/t51.2885-15/e15/s240x240/46276509_388170972011907_7609813800358803282_n.jpg 240w,https://scontent-frx5-1.cdninstagram.com/vp/af2eff79d9c38b0f97a763041e3a99e5/5C0D10C3/t51.2885-15/e15/s320x320/46276509_388170972011907_7609813800358803282_n.jpg 320w,https://scontent-frx5-1.cdninstagram.com/vp/bad123f6264636de35489b7d8dc2cbed/5C0CC199/t51.2885-15/e15/s480x480/46276509_388170972011907_7609813800358803282_n.jpg 480w,https://scontent-frx5-1.cdninstagram.com/vp/93a4e36addf453f754e4caba706fe93a/5C0CC82C/t51.2885-15/e15/s640x640/46276509_388170972011907_7609813800358803282_n.jpg 640w" src="https://scontent-frx5-1.cdninstagram.com/vp/93a4e36addf453f754e4caba706fe93a/5C0CC82C/t51.2885-15/e15/s640x640/46276509_388170972011907_7609813800358803282_n.jpg" style=""></div><div class="_9AhH0"></div></div><div class="u7YqG"><div class="Byj2F"><span class="glyphsSpriteVideo_large u-__7" aria-label="Video"></span></div></div></a>
a href,然后出现我需要的链接
答案 0 :(得分:0)
要提取文本 视频,您可以使用以下任一解决方案:
(defun options ()
(write-string
"
Searching methods.
For DFS method enter 1.
For BFS method enter 2.
For BESTFS method enter 3.
Choose searching method:
")
(finish-output)
(case (read)
(1 'DFS)
(2 'BFS)
(3 'BESTFS)))
:
(defparameter *option-prompt*
"
Searching methods.
For DFS method enter 1.
For BFS method enter 2.
For BESTFS method enter 3.
Choose searching method:
")
(defun options ()
(write-string *option-prompt*)
(finish-output)
(case (read)
(1 'DFS)
(2 'BFS)
(3 'BESTFS)))
css_selector
:
driver.find_element_by_css_selector("a[href='/p/BrDudIUBuNr/'] span.glyphsSpriteVideo_large").get_attribute("aria-label")