1
votes

My test is failing due to error:

element not interactable 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)

Some info
selenium standalone 3.141.59
geckodriver v0-26.0
Google Chrome Version 79.0.3945.130 (Official Build) (64-bit)
This part of the code is for a non angular page.

As you can see on the code below, I added browser.sleep(), what didn't solve my problem The element causing the problem is on the last line (id('column_header_44)

  it('should compare the space size stored, against the value stored in app', function () {
        browser.driver.manage().window().maximize();
        browser.sleep(2000);
        browser.switchTo().frame(element(by.className('designer-client-frame')).getWebElement());
        browser.sleep(2000);
        element(by.css('div:nth-child(1) > .ms-Link > .ms-navbar-node-caption > span')).click();//click in Item
        browser.sleep(2000);
        element(by.css('.horizontal-flex-container-item-layout--paigVxanvxFrIsRy2U02r:nth-child(3) .thm-head-a2-font-size-1--medflat > span')).click();//click in process
        browser.sleep(2000);
        element(by.css('.ms-ContextualMenu-item:nth-child(1) .thm-popp-a2-font-stack-2--minflat')).click();//click in Time phased
        browser.sleep(3000);
       element(by.id('column_header_44')).click();//click on item no
        browser.sleep(3000);

    })
2

2 Answers

0
votes

You should avoid using browser.sleep as an explicit waiting method. Use Protractor specific methods instead.
A good way to use a wait before that click would be to wait until the element is present in the html DOM (presenceOf), then wait for it to be clickable (elementToBeClickable), and finally, execute the clicking action:

it('should compare the space size stored, against the value stored in app', async () => {
    const EC = protractor.ExpectedConditions;
    const your_element = element(by.id('column_header_44'));

    await browser.wait(EC.presenceOf(your_element));
    await browser.wait(EC.elementToBeClickable(your_element));
    await your_element.click();
});
0
votes

It gives such an error because it does not see the button on the screen. it has to be clicked with javascript.

<input id="myHeader"/>

ChromeDriver driver = null;
    var options = new ChromeOptions();
    driver = new ChromeDriver(options);
    IWebElement element = driver.FindElementById("myHeader");
    IJavaScriptExecutor executor = (IJavaScriptExecutor)driver;
    executor.ExecuteScript("arguments[0].click();", element);