Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

val(text) doesn't work when we try to write text inside an iFrame #166

Closed
jordiponsllaurado opened this issue Jun 29, 2016 · 6 comments
Closed

Comments

@jordiponsllaurado
Copy link

jordiponsllaurado commented Jun 29, 2016

Hi,

Every time that I want to use the $(element).val(text) in an element like this one:

screen shot 2016-06-29 at 16 04 11

I get the following error:

Caused by: org.openqa.selenium.WebDriverException: Element must be user-editable in order to clear it.
Build info: version: '2.51.0', revision: '1af067d', time: '2016-02-05 19:15:17'
System info: host: 'JordiPonss-MacBook-Pro-1194.local', ip: '192.168.38.180', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.5', java.version: '1.8.0_66'
Driver info: driver.version: unknown
Command duration or timeout: 500 milliseconds
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'JordiPonss-MacBook-Pro-1194.local', ip: '192.168.38.180', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.5', java.version: '1.8.0_66'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=45.2.0, platform=MAC, nativeEvents=false, acceptSslCerts=true, webdriver.remote.sessionid=52a9201d-0867-4fa3-94e9-3202c5f8db5e, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 52a9201d-0867-4fa3-94e9-3202c5f8db5e
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
    at org.openqa.selenium.remote.RemoteWebElement.clear(RemoteWebElement.java:113)
    at io.github.seleniumquery.functions.jquery.forms.ValFunction.val(ValFunction.java:131)
    at io.github.seleniumquery.functions.jquery.forms.ValFunction.val(ValFunction.java:87)
    at io.github.seleniumquery.functions.SeleniumQueryFunctions.valueWrite(SeleniumQueryFunctions.java:59)
    at io.github.seleniumquery.internal.SqObject.val(SqObject.java:164)

This is the html code for the iFrame:
screen shot 2016-06-29 at 16 07 24

Any idea of what is happening? I tried different element values but one of them is $(//*[@id='CQrte']/p).val("test") and before executing this line I changed to the correct iframe

@acdcjunior
Copy link
Member

acdcjunior commented Jun 30, 2016

I see, from the stack trace, the browser you are using is a Firefox 45.2.0 at a Mac OS X, can you confirm?

Which version of seleniumQuery are you using? From the message I assume 0.13.0, correct?

This error is thrown when the code attempts to edit an element that is not user-editable (that is, it is not an input, textarea - or similar -, nor it has the contenteditable attribute).

I don't know that component (do you know any place I can see it running?), but what if you edit the <textarea> with id ext-comp-1343? Maybe that iframe is just rendering the <textarea>'s content.

Update:
Now I realized, since it is an <iframe>, it probably has the designMode turned on. I honestly don't know how Selenium itself behaves in these situations. I'm checking it out.

@jordiponsllaurado
Copy link
Author

I'm using Firefox 45.2.0ESR at a Mac OS X with SeleniumQuery v0.15.0

I don't think that you can see this component running, the place where we use is inside a CMS called AEM from adobe.

I will try to edit using the textarea and see if it works or not, I will keep you inform about it.

@jordiponsllaurado
Copy link
Author

If I use browser.getDriver().findElement(By.xpath("//*[@id='CQrte']/p")).sendKeys(text); instead of $(("//*[@id='CQrte']/p").val(text) it works

@acdcjunior
Copy link
Member

Hum, that is good to know. I'm working on a way to skip the clearing part (the one Firefox rejects).

In the meanwhile you can use .get(0) to get a hold of the WebElement and send the keys directly, something like $("//*[@id='CQrte']/p").get(0).sendKeys(text).

I will let you know when I have a solution.

acdcjunior added a commit that referenced this issue Jul 2, 2016
…signMode=on iframes

This should handle editing other editable-but-without-contenteditable-attribute elements as well.

#166
acdcjunior added a commit that referenced this issue Jul 2, 2016
…more tests for .val() and iframes

[run sauce]
#166
@acdcjunior acdcjunior self-assigned this Jul 2, 2016
@acdcjunior acdcjunior added this to the 0.16.0 milestone Jul 2, 2016
@acdcjunior
Copy link
Member

Hey, there.
I have just deployed to maven central the 0.16.0 version.
It includes the update of Selenium (from 2.53.0 to 2.53.1) and a small change on .val() that should make your problem go away.

I will close this issue for the moment. Please feel free to report, reopen this issue or open another, if you have any new, ok? Thanks!!

@jordiponsllaurado
Copy link
Author

Ok, I'll try it one of those days and reopen it if the issue persists.

Thanks

acdcjunior added a commit that referenced this issue Dec 15, 2017
…signMode=on iframes

This should handle editing other editable-but-without-contenteditable-attribute elements as well.

#166
acdcjunior added a commit that referenced this issue Dec 15, 2017
…more tests for .val() and iframes

[run sauce]
#166
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants