--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
If the element is read-only, then the real user could not input text into it. Since Selenium tries to simulate user actions, it would not be allowed to input text.Have you tried other strategies to make the element writable? Like `Click Element`?
On Fri, Oct 21, 2016 at 4:06 AM, Ferawati Hartanti Pratiwi <ferawati...@gmail.com> wrote:
Hi,
I have a problem with readonly element..
I have an element <input id="date" class="date" placeholder="dd/mm/yy" readonly="" value="" data-parsley-id="4" type="text"> an input for a date
I've tried to evolve a method from resource https://groups.google.com/forum/#!topic/robotframework-users/u2kCnXuzWJw
${element}= set variable xpath=//input[@id='date' and @class='date']
Mouse Over ${element}
Execute JavaScript return window.document.getElementById('${element}').readOnly = falseInput Text ${element} 13/11/2016
but it didnt work..its show WebDriverException: Message: JavaScript error
anyone has an experience with a readonly element robot framework?? please help thank you very much
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Ugh
I actually run in to the same problem today. The error is caused by the selenium being picky but error is raised when element is cleared. Input Text keyword will do this:
element = driver.find_by_xpath("//path/to/element")
element.clear() # exception is raised here
element.send_keys("some text")
But this works:
element = driver.find_by_xpath("//path/to/element")
element.send_keys("some text")
There could be some justification to keep input as read only for security reasons. But if you are happy with the above solution, one can turn the code to a keyword. Example this could work:
from robot.libraries.BuiltIn import BuiltIn
def send_keys(xpath, text):
s2l = BuiltIn().get_library_instance('Selenium2Library')
driver = s2l._current_browser()
element = driver.find_by_xpath(xpath)
element.send_keys(text)
Please note that the code is written out of my memory and is untested.
-Tatu
Send from my mobile
I've tried but if there is another way except Click Element..because I want to input the date with current date so Click Element kind of inflexible I think..
On Friday, October 21, 2016 at 2:55:35 PM UTC+7, Hélio Guilherme wrote:
If the element is read-only, then the real user could not input text into it. Since Selenium tries to simulate user actions, it would not be allowed to input text.Have you tried other strategies to make the element writable? Like `Click Element`?
On Fri, Oct 21, 2016 at 4:06 AM, Ferawati Hartanti Pratiwi <ferawati...@gmail.com> wrote:
Hi,
I have a problem with readonly element..
I have an element <input id="date" class="date" placeholder="dd/mm/yy" readonly="" value="" data-parsley-id="4" type="text"> an input for a date
I've tried to evolve a method from resource https://groups.google.com/forum/#!topic/robotframework-users/u2kCnXuzWJw
${element}= set variable xpath=//input[@id='date' and @class='date']
Mouse Over ${element}
Execute JavaScript return window.document.getElementById('${element}').readOnly = falseInput Text ${element} 13/11/2016
but it didnt work..its show WebDriverException: Message: JavaScript error
anyone has an experience with a readonly element robot framework?? please help thank you very much
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsubscrib...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.