我正在使用selenium在python上编写代码,并登录到Facebook,就像我请求的Facebook页面一样。它可以登录,但是在打开我请求的Facebook页面后,它将不会喜欢该页面。任何帮助将不胜感激
答案 0 :(得分:1)
首先,当您登录Facebook时,您需要找到DOM(文档对象模型)或元素。 Facebook中每个链接的每个按钮都包含其自己的Dom属性。例如,假设您在网站上看到一个按钮,只需按f12键即可查看按钮属性,该属性可能包含id,class或tag字段。您需要找到id或标签,然后需要将该元素传递到代码中。
id =“一个”
在您的python脚本中,
硒库具有一个称为find_element_by_id的属性。 只需将ID传递到属性find_element_by_id(“ one”)。click()
就是这样。