有没有一种方法可以帮助我使用python硒赞Facebook页面

时间:2020-02-21 08:13:59

标签: python

我正在使用selenium在python上编写代码,并登录到Facebook,就像我请求的Facebook页面一样。它可以登录,但是在打开我请求的Facebook页面后,它将不会喜欢该页面。任何帮助将不胜感激

First it go to my Facebook account ,Then it find the page i requested after that it goes to a specific post found on that page and like the post

1 个答案:

答案 0 :(得分:1)

首先,当您登录Facebook时,您需要找到DOM(文档对象模型)或元素。 Facebook中每个链接的每个按钮都包含其自己的Dom属性。例如,假设您在网站上看到一个按钮,只需按f12键即可查看按钮属性,该属性可能包含id,class或tag字段。您需要找到id或标签,然后需要将该元素传递到代码中。

id =“一个”

在您的python脚本中,

硒库具有一个称为find_element_by_id的属性。 只需将ID传递到属性find_element_by_id(“ one”)。click()

就是这样。