Hello,
I have the same ... wish like you. But I have a workaround for it.
Here's my code, hope that it's clear for you:
String script = "document.getElementsByName('sitetitle')
[0].setAttribute('maxlength',
1000);document.getElementsByName('sitetitle')
[0].value='123456789123456789123456789123456789123456789123456789123456789';";
(driver as IJavaScriptExecutor).ExecuteScript(script);
In this case, the "sitetitle" element with the maxlength attribute
doesn't allow me to input the data which length is over 50. So I use
script to overcome it.
HTS
On Jul 8, 4:15 pm, techi <
ppad...@gmail.com> wrote:
> Hi ,
>
> When can we expect the next release of WebDriver and having a method
> like
> WebElementsetAttribute(attribute, newValue) ;
>
> Having such method could solve a lot of problems when using
> JavascriptExecutor.
> WebDriver is a good tool, however it lacks of many features , so the
> easiest and quickest way of finding out a temporary solution is mixing
> Javascript through JavascriptExecutor and webdriver API.
>
> For instance I have a website that contains a tree of many elements,
> after finding a certain WebElement using many combinations of
> el1.findElement. ... findElement etc.. I get a reference for
> WebElement ,i need to perform a specific operation on that element
> ( right click, or invoke a javascript function on that element,
> developers created some API for accessing and manipulating DOM
> elements)
>
> How could I do it ? The found element does not contain id attribute. I
> think what I could do is tosetAttributefor that element and then