早上好, 我目前正在尝试使用Python selenium下载instagram帖子的某个字段。具体地说,我正在尝试下载图片的标题(描述)(例如,在下面的图片中是以文本“Thank@lolap…”开头的部分,一直下载到标签
我尝试了以下代码,但它似乎不起作用(它会立即抛出异常):
caption = driver.findElement(By.xpath("/html/body/div[3]/div[2]/div/article/div[2]/div[1]/ul/div/li/div/div/div[2]/span/text()")) #get all the caption text in a String
谢谢你的帮助
这对我有用
我的ig posts的类是
xil3i
,但使用.text
时得到一个空值 . 这段代码解决了我的问题你只是想收集所有的标签吗
试试这个:
或者,如果您正在查找图片描述:
相关问题 更多 >
编程相关推荐