无法单击表单内部的按钮(其所说的带有定位器的元素是不可见的)

发布于 2025-02-06 17:08:24 字数 583 浏览 2 评论 0原文

我想在框架中选择一个按钮。 但是有些未选择。在下面的代码中尝试切换到帧并单击typescript中的元素。

await browser.switchTo().frame(element(by.xpath("//div[@id='main-container']")).getWebElement()); 
await this.element(by.css('.uploadDiv #uploadP')).click(); --> Did not work

let frame3 = element(by.xpath("//div[@id='main-container']")).getWebElement();
        browser.switchTo().frame(frame3); 
await this.element(by.css('.uploadDiv #uploadP')).click(); --> Did not work

在给定的屏幕截图中查看其HTML

I wanted to select a button in a Frame ..
But some how its not selecting .. Tried below code to switch to frame and click on element in Protractor with TypeScript ..

await browser.switchTo().frame(element(by.xpath("//div[@id='main-container']")).getWebElement()); 
await this.element(by.css('.uploadDiv #uploadP')).click(); --> Did not work

let frame3 = element(by.xpath("//div[@id='main-container']")).getWebElement();
        browser.switchTo().frame(frame3); 
await this.element(by.css('.uploadDiv #uploadP')).click(); --> Did not work

See the HTML of it in given screen shot

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

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

发布评论

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

评论(1

时间你老了 2025-02-13 17:08:24

您可以打印元素矩形或获取InnerHTML以查看该元素是否隐藏。

一种更简单的方法是利用某些录音机工具,例如Vistual Studio代码ClickNium扩展名来记录元素,然后进行验证,它将突出显示目标元素位置

you can print the element rectangle or get innerhtml to see whether the element is hidden.

an easier way is to leverage some recorder tools such as vistual studio code clicknium extension to recorde the element and then do validation, it will highlight the target element position

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文