admin管理员组

文章数量:1023758

InvalidElementState An element mand could not be pleted because the element is in an invalid state (e.g. attempting to click a disabled element).
        invalid element state: Element must be user-editable in order to clear it.

(Session info: chrome=49.0.2623.75) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.11.4 x86_64) (WARNING: The server did not provide any stacktrace information) [09:49:15]: ERROR Unknown Remote end send an unknown status code. RuntimeError: invalid element state: Element must be user-editable in order to clear it.

Screenshot:

This form is been implemented using jquery Text selector library . is there any other way to set the Value ?

InvalidElementState An element mand could not be pleted because the element is in an invalid state (e.g. attempting to click a disabled element).
        invalid element state: Element must be user-editable in order to clear it.

(Session info: chrome=49.0.2623.75) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.11.4 x86_64) (WARNING: The server did not provide any stacktrace information) [09:49:15]: ERROR Unknown Remote end send an unknown status code. RuntimeError: invalid element state: Element must be user-editable in order to clear it.

Screenshot:

This form is been implemented using jquery Text selector library . is there any other way to set the Value ?

Share Improve this question edited Jun 7, 2016 at 8:35 Moumit 9,6809 gold badges58 silver badges65 bronze badges asked Jun 7, 2016 at 7:47 VaramVaram 231 gold badge2 silver badges5 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

In this case you should use below approach to setValue in input field :-

WebElement inputEl = driver.findElement(By.xpath("xPath exression"));
inputEl.click();
inputEl.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.DELETE, "valuet to set");

if you want to use JavascriptExecutor, try below approach :-

JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click();arguments[0].value='';arguments[0].value=arguments[1];",inputEl,"valuet to set");

Edited..

You need to click on element before set value to enable this input if it's disappears..

Hope this will help you...:)

InvalidElementState An element mand could not be pleted because the element is in an invalid state (e.g. attempting to click a disabled element).
        invalid element state: Element must be user-editable in order to clear it.

(Session info: chrome=49.0.2623.75) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.11.4 x86_64) (WARNING: The server did not provide any stacktrace information) [09:49:15]: ERROR Unknown Remote end send an unknown status code. RuntimeError: invalid element state: Element must be user-editable in order to clear it.

Screenshot:

This form is been implemented using jquery Text selector library . is there any other way to set the Value ?

InvalidElementState An element mand could not be pleted because the element is in an invalid state (e.g. attempting to click a disabled element).
        invalid element state: Element must be user-editable in order to clear it.

(Session info: chrome=49.0.2623.75) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.11.4 x86_64) (WARNING: The server did not provide any stacktrace information) [09:49:15]: ERROR Unknown Remote end send an unknown status code. RuntimeError: invalid element state: Element must be user-editable in order to clear it.

Screenshot:

This form is been implemented using jquery Text selector library . is there any other way to set the Value ?

Share Improve this question edited Jun 7, 2016 at 8:35 Moumit 9,6809 gold badges58 silver badges65 bronze badges asked Jun 7, 2016 at 7:47 VaramVaram 231 gold badge2 silver badges5 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

In this case you should use below approach to setValue in input field :-

WebElement inputEl = driver.findElement(By.xpath("xPath exression"));
inputEl.click();
inputEl.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.DELETE, "valuet to set");

if you want to use JavascriptExecutor, try below approach :-

JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click();arguments[0].value='';arguments[0].value=arguments[1];",inputEl,"valuet to set");

Edited..

You need to click on element before set value to enable this input if it's disappears..

Hope this will help you...:)

本文标签: javascriptwebdriverio 39setValue39 to an input field throws error InvalidElement StateStack Overflow