首页 > 解决方案 > 无法在“应用”按钮下找到 Linkedlin 网站的元素

问题描述

我为LinkedIn的以下步骤创建了自己的自定义xpath:

  1. www.linkedin.com - 启动 URL
  2. 登入
  3. 查看资料
  4. 点击职位
  5. 输入 QA Lead
  6. 点击发布日期
  7. 24小时内选择
  8. 单击应用 <----- 在这里我无法单击此按钮。

Xpath: driver.findElement(By.xpath("button[@class='facet-collection-list__cancel-button mr2 artdeco-button artdeco-button--静音 artdeco-button--2 artdeco-button--tertiary ember-view' ]//span[text()='Cancel']/parent::button/following-sibling::button//span[@class='artdeco-button__text']")).click();

在此处输入图像描述

标签: xpathdynamic

解决方案


我能够弄清楚。我相应地修改了xpath并且它起作用了:

driver.findElement(By.xpath("//*[@data-control-name='filter_pill_cancel' and @class='facet-collection-list__cancel-button mr2 artdeco-button artdeco-button--静音 artdeco-button-- 2 artdeco-button--tertiary ember-view']//span[@class='artdeco-button__text' and text()='Cancel']/parent::button/following-sibling::button//span[text ()='应用']")).click();


推荐阅读