Skip to content Skip to sidebar Skip to footer

Find A Special Kind Of Buttons With Selenium And Python

I want to click in one button from the linkedin page with this code:  Connect

Solution 1:

From the limited information that you have provided seems like the problem is because of find_elements, note the 's'

This:

code driver.find_elements_by_css_selector("a[class='vcard-button bt-connect bt-primary']")

returns a list of webelements.

So what you might want to do is

connect = code driver.find_element_by_css_selector("a[class='vcard-button bt-connect bt-primary']")
connect.click()

Or

connect_buttons = code driver.find_elements_by_css_selector("a[class='vcard-button bt-connect bt-primary']")
# Assuming the first index in the returned list of web elements contains the Webelement# You want to interact with 
connect_buttons[0].click() 

Post a Comment for "Find A Special Kind Of Buttons With Selenium And Python"