无法点击<a>标签 - Selenium



当尝试使用Newrelic合成监视器(基于硒)点击链接时,它似乎已经开始失败了。错误的截图显示控件悬停在链接上,但没有点击。

.then(function() {
log(10, 'clickElement "Dashboard"');
return $browser.waitForAndFindElement(By.xpath('//*[contains(text()," Dashboard ")]'), DefaultTimeout); })
.then(function (el) { el.click();  })

元素:

<a _ngcontent-avd-c527="" cdkmonitorelementfocus="" rel="noopener noreferrer" queryparamshandling="merge" class="name trimmedTextWithEllipsis ng-star-inserted" href="**" target="_self" pbi-focus-tracker-idx="17"> Dashboard <!----><!----><!----><!----></a>

My " favorites "自动化的问题。你可以试试:

  1. 检查HTML是否已经更改(新的iframe或另一个接收点击的锚元素)。
  2. 单击一次以上。试试双击。
  3. 使用Actions类尝试另一种类型的点击https://www.selenium.dev/documentation/webdriver/actions_api/mouse/
  4. 试着调试,如果在调试中不能重现,可能是时间问题,所以你可以再等一会儿。

最新更新