Alok Mishra
Alok Mishra

Reputation: 704

How to click automatically on "Content" button

This is element HTML:

<button class="search-vertical-filter__filter-item-button button-tertiary-medium-muted" data-ember-action="" data-ember-action-5975="5975"> Content </button>   

Code:

driver.find_element_by_link_text('Content').click()

Even i also tried:

driver.find_element_by_class_name('search-vertical-filter__filter-item-button button-tertiary-medium-muted').click()

I want to click on "Content" button on LinkedIn automatically and I am using Selenium and Python for that.

Upvotes: 2

Views: 85

Answers (2)

Ratmir Asanov
Ratmir Asanov

Reputation: 6459

Try to use the following code:

driver.find_element_by_css_selector(".search-vertical-filter__filter-item-button.button-tertiary-medium-muted").click()

Hope it helps you!

Upvotes: 1

undetected Selenium
undetected Selenium

Reputation: 193298

As per the HTML provided to click on the button with text as Content you can use the following line of code :

driver.find_element_by_xpath("//button[@class='search-vertical-filter__filter-item-button button-tertiary-medium-muted' and normalize-space()='Content']").click()

Upvotes: 1

Related Questions