单击元素 - 量角器 [英] Click on element - Protractor

查看:50
本文介绍了单击元素 - 量角器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有非常疯狂的 HTML 并且我试图点击元素,不幸的是没有成功.

I have pretty crazy HTML and I am trying to click on element, unfortunately without success.

HTML 看起来像

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 5845 3897">

以及下面的多个具有不同 ID 等等..

and below that multiple with different ID and so on..

<g id="30_0_80" transform="translate(420,754)" class="">
 <path class="fp x80 xab active" d="M307 0 L293 15 L155 120 L87 181 L47 220 L0 277 L0 282 L14 341 L27 379 L32 386 L32 386 L74 425 L123 461 L153 480 L188 500 L238 525 L303 551 L337 563 L340 563 L381 561 L490 560 L492 557 L522 526 L591 473 L662 430 L745 383 L770 368 L785 358 L796 350 L802 343 L806 335 L809 321 L809 318 L810 295 L808 293 L806 293 L763 292 L680 277 L643 269 L590 253 L555 239 L555 239 L508 214 L452 179 L397 138 L369 115 L339 79 L325 56 L310 28 L308 23 L308 19 L310 1 L307 0 Z"></path>
 <path class="p x88 xc7" d="M796 296 L792 300 L736 324 L595 391 L486 455 L413 505 L349 559"></path>
 <path class="p x88 xc7" d="M33 372 L57 324 L82 284 L128 228 L133 222 L134 221 L164 188 L222 131 L252 102 L281 69"></path><path class="p x88 xc7" d="M9 283 L24 261 L52 221 L79 190 L88 182"></path><path class="p x88 xc7" d="M169 175 L251 97 L284 60 L295 40 L303 25"></path><path class="p x88 xc7" d="M132 214 L119 229 L88 266"></path>
 <path class="p x88 xc7" d="M72 287 L54 315"></path><path class="p x88 xc7" d="M47 326 L44 331 L29 360"></path>
</g>

我所做的尝试:

element(by.css('[transform="translate(420,754)"]')).click();

还有:

element(by.id('30_0_80')).click();

我得到的错误:

UnknownError:断开连接:未连接到 DevTools

UnknownError: disconnected: not connected to DevTools

有人可以帮我找出问题所在吗?

Is there a chance someone can help me figurate out where is a problem?

经过更深入的分析,基于 alecxe 评论,我使用 DevTools 修复了以前的错误,但仍然无法找到元素,尽管我可以在浏览器代码中看到该元素.

After deeper analyze, base on alecxe comment i fix previous error with DevTools, but still having problem with finding element, dispite the fact if I can see that element in browser code.

No element found using locator: By.id("30_0_80")

推荐答案

经过一番研究,我发现 iframe 正在页面顶部加载,我试图点击 IFRAME,这就是我无法找到元素的原因.

After some research I found out iframe is loading on TOP of page, and I was trying to click to IFRAME that's why I wasn't able to find element.

感谢@alecxe 以正确的方式引导我使用开发工具.

Thanks @alecxe for lead me in right way with DEV TOOls.

如果您想知道如何点击 iFrame,请参阅此处:量角器 - 在 iframe 中查找元素

If you wonder how to click to iFrame, it is described here: Protractor - find element in iframe

这篇关于单击元素 - 量角器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆