无法单击A< a>标签 - 硒

发布于 2025-02-09 23:53:49 字数 643 浏览 1 评论 0 原文

在尝试使用NewRelic合成监视器(基于Selenium)的链接单击链接时,它似乎已经开始失败了几天。错误的屏幕截图显示了在链接上徘徊的控件,但没有单击。

.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>

While trying to click on a link using Newrelic synthetic monitor(selenium based), it appears to have started failing since few days. The screenshot of error shows the control hovered over the link but didnt click.

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

Element:

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

好久不见√ 2025-02-16 23:53:49

我的“最喜欢”的自动化问题。您可以尝试:

  1. 检查HTML是否已更改(新的iFrame或其他接收单击的锚元素)。
  2. 单击不止一次。尝试双击。
  3. 使用操作类尝试另一种类型的单击
    https://wwwww.selenium.dev/documentation /documentation/webdriver/webdriver/webdriver/actions_api/actions_api/mouse/
  4. 尝试调试,如果在调试中不可再现,则可能是时机问题,因此您可以尝试等待更多。
  5. 调查您正在测试的应用程序中是否是错误。

My "favourite" automation issues. You can try:

  1. Check if the HTML has changed (new iframe or another anchor element that receives the click instead).
  2. Click more than once. Try double click.
  3. Try another type of click using the Actions class
    https://www.selenium.dev/documentation/webdriver/actions_api/mouse/
  4. Try to debug and if it is not reproducible in debug, it may be timing issue so you can try to wait a bit more.
  5. Investigate if it is a bug in the application you are testing.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文