Skip to content Skip to sidebar Skip to footer

Click Button By Find_element_by_class_name Not Working Python Selenium Webdriver Not Working

I'm trying to add contacts on LinkedIn using Python and Selenium. I'm attempting to do so by adding the contact suggestions made by LinkedIn in the 'Network' tab (https://www.linke

Solution 1:

You should use find_elements for finding all elements with same class Try this to get all elements:

elements = driver.find_elements_by_class_name("mn-person-card__person-btn-ext.button-secondary-medium")

then use a for loop to click each of them. For example:

for e in elements:
    e.click()

Solution 2:

The way you are trying to use find_element_by_class_name locator is not correct as this locator doesn't support compound classes within.

You need to use either xpath or cssSelector if class attribute have more then one class name :

driver.find_element_by_xpath("//button[@class='mn-person-card__person-btn-ext button-secondary-medium']").click()

Post a Comment for "Click Button By Find_element_by_class_name Not Working Python Selenium Webdriver Not Working"