【问题标题】:How to click automatically on "Content" button如何自动点击“内容”按钮
【发布时间】:2018-02-18 13:00:26
【问题描述】:

这是 HTML 元素:

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

代码:

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

我也试过了:

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

我想自动点击 LinkedIn 上的“内容”按钮,为此我使用 Selenium 和 Python。

【问题讨论】:

  • 还有,当你运行这段代码时会发生什么?

标签: python selenium web linkedin screen-scraping


【解决方案1】:

尝试使用以下代码:

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

希望对你有帮助!

【讨论】:

  • 是的,你解决了我的问题,谢谢兄弟,现在我的任务是自动从页面复制链接...... :)
【解决方案2】:

根据 HTML 提供的单击带有文本作为 Content 的按钮,您可以使用以下代码行:

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

【讨论】:

  • 这对我很有帮助,但是通过使用此代码,他们将我定向到人们页面....
猜你喜欢
  • 2021-03-22
  • 1970-01-01
  • 1970-01-01
  • 2016-07-22
  • 2016-12-25
  • 2012-02-17
  • 1970-01-01
  • 1970-01-01
  • 2022-01-20
相关资源
最近更新 更多