如何从selenium python中提取href标记元素?

2024-05-13 20:03:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我对Selenium很陌生,希望在下面的案例中能得到帮助。我正在尝试为Facebook制作一个生日机器人。我正在运行禁用js的selenium,这使得代码更容易,因为我在Facebook的最新UI中操作起来有点困难。 现在,我尝试访问当前生日的文本框,但我无法访问,因此我尝试提取所有今天过生日的朋友的个人资料链接。 我尝试过使用下面的代码片段,但实际上没有任何效果。 如果我可以将_键发送到文本框或从

请查看图片了解详细信息

birthday = driver.find_element_by_css_selector('bj cf cq')
containers=birthday.find_element_by_css_selector("[class='bj cf cq']")
containers=birthday.find_element_by_xpath('//*[@id="events_dashboard_calendar_container"]/div/article[1]/div')
birthdayslist= birthdaystoday.find_elements_by_css_selector("[class='ce cf cg']")

list=driver.find_element_by_xpath('//*[@id="events_dashboard_calendar_container"]/div/article[1]/div/ul/div[2]')

//*[@id="events_dashboard_calendar_container"]/div/article[1]/div/ul/div[2]
driver.find_elements_by_class_name("ce cf cg")

find_element_by_tag_name("a").get_property("href")

page source code


Tags: dividbycontainerdriverelementfindevents