0
votes

I am trying to automate login in LinkedIn with Python and Selenium.

Where I am stuck so far is on the Sign in button. When I try to click it with

driver.find_element_by_xpath('//a[text()="Sign in"]').click() I get an error:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element ... is not clickable at point (1273, 80). Other element would receive the click: ... (Session info: chrome=79.0.3945.130)

Tried also driver.find_element_by_xpath('//*[contains(concat( " ", @class, " " ), concat( " ", "nav__button-secondary", " " ))]').click() which I generate by using SelectorGadget extension for Google Chrome and got the same error as mentioned above...

As for my Chrome version it is : Version 79.0.3945.130 (Official Build) (64-bit) same as my WebDriver version for Windows.

2

2 Answers

0
votes

It looks like when you open linkedin, the page is scrolled down a little bit. Try scrolling up to the top or more precise - scrolling to the element

You could also just copy the link that 'sign in' button points to and go there straight away.

If signing in is not the whole point, you can also sign in manually and tell selenium to use your profile, so you're already signed in when the script starts.

Exporting cookies might also do the trick.

EDIT: closing the pop-up window solved it.

0
votes

I automated the login using Python 3 and Selenium 3.141.0 today (I don't know how long it will work) and I found a way to do it using find_element_by_class_name with the sign-in-form__submit-button class name:

def run(email, password):
#Open Chrome web
driver = webdriver.Chrome()
driver.get('https://www.linkedin.com/')

#Login username/password
email_box = driver.find_element_by_id('session_key')
email_box.send_keys(email)
pass_box = driver.find_element_by_id('session_password')
pass_box.send_keys(password)
submit_button = driver.find_element_by_class_name('sign-in-form__submit-button')
submit_button.click()

I'm using Chrome Version 88.0.4324.96 (Official Build) (x86_64) on MacOS.