Protractor: Element is not currently interactable and may not be manipulated

Multi tool use
Multi tool use


Protractor: Element is not currently interactable and may not be manipulated



I was trying to locate an element to set the value under a form (popped up after clicked on a button on a page), but unable to locate such element after the form popped up, with below error:


Failed: invalid element state: Element is not currently interactable and may not be manipulated



The HTML code snippets are as follows:


<input class="form-control fc_short not-empty ng-pristine ng-not-empty ng-valid ng-valid-required ng-touched" ng-model="myNGModel" name="NGModel" ng-required="true" required="required" style="" type="text">



Below were the implemented codes:


it('should enter ABC value', function() {
var elem = element.all(by.model('myNGModel')).first();
var theStr = "ABC";
browser.executeScript("arguments[0].scrollIntoView();", elem.getWebElement()).then(function() {
elem.clear();
elem.sendKeys(theStr);
expect(elem.getAttribute('value')).toEqual(theStr);
});
});



Am I miss out any important area? I was able to locate this element using XPath like below:


var elem = element(by.xpath('//*[@id="MyFormID"]/div/div/form/div[2]/div/div[2]/div/div[1]/div[3]/input'));



Below highlighted its CSS path:


html.ng-scope body.modal-open div.pushmenu.cbp-spmenu-push ui-view.ng-scope section#MainArea ng-include.ng-scope div#MyFormID.modal.modal-create.modal-2-col.ng-scope.in div.modal-dialog div.modal-content form.ng-pristine.ng-valid-required.ng-invalid.ng-invalid-required div.modal-body div.row div.col-md-8.col-md-pull-4 div.spanel div.top_panel div.form-group input.form-control.fc_short.not-empty.ng-pristine.ng-not-empty.ng-valid.ng-valid-required.ng-touched




1 Answer
1



The exception get's thrown on the clear method block


clear


elem.clear();
elem.sendKeys(theStr);
expect(elem.getAttribute('value')).toEqual(theStr);



the element although is present on the page, cannot be interacted with- the input would be read only that's why it is throwing this error. You may need to wait for some time in order for the element to be intractable or do it explicitly.


read only



Please read this explanation given here.





I have removed elem.clear() and now I am facing this error - Failed: element not visible
– user9451209
Jul 2 at 10:38





I tried also waited explicitly after removed elem.clear() but it just given timed out. Failed: Expected 'by.model("myNGModel")' to be present and visible. After 308 driverWaitIterations. Last webdriver error: TimeoutError: Wait timed out after 10006ms
– user9451209
Jul 2 at 10:45






The issue is not with clear method - as a general your element cannot be interacted with. Try to see if you can do it manually and then see the changes in DOM. Otherwise, you can provide a minimal example or the URL.
– demouser123
Jul 2 at 10:47



clear





This form is dependent on another modal-content class on same page.
– user9451209
Jul 2 at 11:08





For example, I will navigated into the page, click on a link to open a form to insert details, then save it and follow by open this MyFormID form to fill in data. The earlier form I was able to detect those elements, but not for the MyFormID form's elements.
– user9451209
Jul 2 at 11:22






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

6 Ma mk1Ep4GpKqpsnmGCsMay8ty5kDE,yWw1K
iHee,J2GxyR7,kEm yhxaE,CVIhm1ytHnM2 uEGaTD7 VGGP

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications