Element not interactable in a non Angular site



  • For my test, I am using protractor. The test first opens an Angular page, do some actions and then open a nonangular site. For the nonangular site I did the following:

    it('should login on BC', function(){
     browser.waitForAngularEnabled(false); // disable waiting to navigate to not Angular page
            browser.get('non angularsite');
            element(by.id('UserName')).sendKeys('user');
            element(by.id('Password')).sendKeys('pwd');
            element(by.id('submitButton')).click();
        });
    
    it('should confirm the quantity typed on BC', function () {
        browser.driver.manage().window().maximize();
        browser.sleep(2000);                
        element(by.className('ms-list-itemLink')).click();//click on search button
        browser.sleep(2000);
        browser.switchTo().frame(element(by.className('designer-client-frame')).getWebElement());            
        element(by.css('.thm-cont-g0-bgcolor-1 > .icon-MoreEllipsis')).click();
        browser.sleep(1000);
        element(by.linkText('BFTESTUSER')).click();
        browser.sleep(2000);
        
        element(by.css('.ms-nav-contextmenu-trigger:nth-child(3)')).click();//click on posting date
        browser.sleep(3000);
    
    
    <p>When the automation reaches the</p>
    <pre class="lang-js prettyprint-override"><code>element(by.css('.ms-nav-contextmenu-trigger:nth-child(3)')).click();//click on posting date
    

    I got the following error:

        Failed: element not interactable
          (Session info: chrome=79.0.3945.130)
          (Driver info: chromedriver=79.0.3945.16 (93fcc21110c10dbbd49bbff8f472335360e31d05-refs/branch-heads/3945@{#262}),platform=Windows NT 10.0.18362 x86_64)
      Stack:
        ElementNotVisibleError: element not interactable
          (Session info: chrome=79.0.3945.130)
          (Driver info: chromedriver=79.0.3945.16 
    ```


  • You have to wait till element able to receive click so it would be intractable.

    Please try below code with wait.

    var elm = element(by.css('.ms-nav-contextmenu-trigger:nth-child(3)'));
    var EC = protractor.ExpectedConditions;
    

    browser.wait(EC.elementToBeClickable(elm), 15000);
    elm.click();



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2