简体   繁体   English

如何在我的侧边菜单中单击元素

[英]How to click at element in my side menu

I've trying click at my element which it is on a side menu, after the click, the system opens a new window, which is like a frame. 我尝试单击侧面菜单上的元素,单击后,系统将打开一个新窗口,就像一个框架。 But, using Xpath, protractor clicks at the element (I can see it because the element turns yellow when the mouse is houver) but the windown doesn't open. 但是,使用Xpath,量角器单击了该元素(我可以看到它,因为当鼠标悬停时该元素会变为黄色),但是windown不会打开。 I think protractor is click at the wrong place. 我认为量角器在错误的位置单击。

How can fix it? 如何解决?

the HTML: HTML:

<ul style="margin:10px 0 0 0; padding: 0">
            <li class="menu-content-item ng-star-inserted" title="Principal">
                <a class="ng-star-inserted">
                    <i class="" data-first="P"></i>
                    <span class="sidebar-title-menu"> Principal </span>
                    <i class="zmdi zmdi-chevron-right"></i>
                </a>
            </li>
        </ul>

I already tried: 我已经尝试过:

browser.driver.manage().window().maximize();

and

const menuPrincipal = element(by.css('div[title=Principal]'));

I'm using protractor helper so my code is like this: 我正在使用量角器助手,所以我的代码是这样的:

   async entraNoMeucomOLink() {
        try {
            const menuPrincipal = element(by.xpath('/html/body/application/pjmt-layout/div[1]/pjmt-bar/div/pjmt-menu-vertical/div[1]/div/ul/li/a/');
            protractorHelper.waitForElementVisibility(menuPrincipal, 'MENU PRINCIPAL NAO ESTA VISIVEL', 5000);
            browser.actions().mouseMove(elemento).click().perform();(menuPrincipal)
        }

The element is like this : 元素是这样的:

侧面菜单

It's not clear what you want. 不清楚你想要什么。 I change your code. 我更改您的代码。 Try this one and give feedback, please) 试试这个并提供反馈,请)

  async entraNoMeucomOLink() {
     const menuPrincipal = $('.sidebar-title-menu');
     protractorHelper.waitForElementVisibility(menuPrincipal, 'MENU PRINCIPAL NAO ESTA VISIVEL', 5000);
     await menuPrincipal.click();
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM