如何使用Selenium Python注销linkedin - python

我正在尝试使用以下代码从linkedin注销,但它给了我这个错误:AttributeError:'list'对象没有属性'click'

登录成功,但是不执行注销代码并退出。

  

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from bs4 import BeautifulSoup
import time


driver = webdriver.Chrome(executable_path=r'C:\Users\Shivam\Documents\scrapin\chromedriver.exe')
driver.get('https://www.linkedin.com/uas/login?goback=&trk=hb_signin')

driver.maximize_window()

email = driver.find_element_by_xpath('//*[@id="username"]')


email.send_keys('******')

time.sleep(3)

password = driver.find_element_by_xpath('//*[@id="password"]')
password.send_keys('*******')


time.sleep(3)

login = driver.find_element_by_xpath('//*[@id="app__container"]/main/div/form/div[3]/button')
login.click()

time.sleep(3)

logout = driver.find_elements_by_xpath('//*[@id="ember1016"]')
logout.click()

python参考方案

您不能依靠这些余烬ID,因为它们是在页面加载时动态生成的。例如,当我加载页面时,“退出”按钮具有id="ember1203"。另外,您需要单击按钮以打开“注销”所在的下拉菜单,然后才能单击它。请尝试以下操作,而不是当前的注销代码:

dropdownButton = driver.find_element_by_css_selector('#nav-settings__dropdown-trigger')
dropdownButton.click()
signoutButton = driver.find_element_by_xpath('//*[@href="/m/logout/"]')
signoutButton.click()

R'relaimpo'软件包的Python端口 - python

我需要计算Lindeman-Merenda-Gold(LMG)分数,以进行回归分析。我发现R语言的relaimpo包下有该文件。不幸的是,我对R没有任何经验。我检查了互联网,但找不到。这个程序包有python端口吗?如果不存在,是否可以通过python使用该包? python参考方案 最近,我遇到了pingouin库。

Python:如何根据另一列元素明智地查找一列中的空单元格计数? - python

df = pd.DataFrame({'user': ['Bob', 'Jane', 'Alice','Jane', 'Alice','Bob', 'Alice'], 'income…

Python pytz时区函数返回的时区为9分钟 - python

由于某些原因,我无法从以下代码中找出原因:>>> from pytz import timezone >>> timezone('America/Chicago') 我得到:<DstTzInfo 'America/Chicago' LMT-1 day, 18:09:00 STD…

Python sqlite3数据库已锁定 - python

我在Windows上使用Python 3和sqlite3。我正在开发一个使用数据库存储联系人的小型应用程序。我注意到,如果应用程序被强制关闭(通过错误或通过任务管理器结束),则会收到sqlite3错误(sqlite3.OperationalError:数据库已锁定)。我想这是因为在应用程序关闭之前,我没有正确关闭数据库连接。我已经试过了: connectio…

将字符串分配给numpy.zeros数组[重复] - python

This question already has answers here: Weird behaviour initializing a numpy array of string data                                                                    (4个答案)         …