What should i say element.getText() returns "" and fails (this is used by 
junit code gen) but element.getAttribute("value") works (using ff 
webdriver).

but thx for the hint with InputElement: but i can't find class/ or 
interface "InputElement" and there is no getProperty(String) in 
"org.openqa.selenium.WebElement" 
(i use selenium-java 2.24.1).


On Thursday, 12 July 2012 12:32:25 UTC+2, Thomas Broyer wrote:
>
>
>
> On Thursday, July 12, 2012 12:20:58 PM UTC+2, tanteanni wrote:
>>
>> Thx Thomas
>>
>> this is working:  assertThat(element.getAttribute("value"), 
>> is("SomeText")); 
>>
>
> It shouldn't.
> (except in IE because GWT simply calls getAttribute(name), and IE looks 
> for the property in this case rather than the attribute: 
> http://msdn.microsoft.com/en-us/library/ie/ms536429(v=vs.85).aspx )
>
> Use element.getValue() instead (possibly casting first to an InputElement: 
> element.<InputElement>cast().getValue()), or 
> element.getPropertyString("value")
>  
>
>>
>> On Wednesday, 11 July 2012 15:32:18 UTC+2, Thomas Broyer wrote:
>>>
>>>
>>> On Wednesday, July 11, 2012 12:41:11 PM UTC+2, tanteanni wrote:
>>>>
>>>> I've tried to make a Seleniumtest on the text content of a suggest box. 
>>>> The text is rendered correctly but don't shows up in rendered code 
>>>> ("inspect element") and selenium also sees only an empty string. The 
>>>> Elment 
>>>> look like this in chrome and friefox:
>>>>
>>>> <input type="text" class="PEB" id="gwt-debug-overviewSuggestbox">
>>>>
>>>> But it is rendered with correct text - i can't find the text anywhere. 
>>>> But in IE 8 the elemnt looks like that:
>>>>
>>>> <input class="PEB" id="gwt-debug-overviewSuggestbox" __eventBits="8064" 
>>>> __listener="<INPUT id=gwt-debug-overviewSuggestbox class=PEB 
>>>> value=SomeText __eventBits="8064">" value="SomeText"/>
>>>>
>>>> So there i see the text "SomeText". Why is this so? Or how to 
>>>> (Selenium)test contents of such fields?
>>>>
>>>
>>> This is an "artifact" of how the DOM is implemented in IE8, and the IE8 
>>> Dev Tools: IE mixes up attributes and properties (even though it can tell 
>>> them apart starting with IE8, but only using the appropriate API), and the 
>>> Dev Tools actually show you the properties: __eventBits and __listener are 
>>> expando properties, and the value here is the property, not the attribute 
>>> (the 'value' attribute maps to the defaultValue property, changing the 
>>> value property shouldn't be reflected in the value attribute).
>>>
>>> In any browser though, getting the value property of the element should 
>>> give you the "SomeText" value: 
>>> document.getElementById("gwt-debug-overviewSuggestbox").value;
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/FT5XVSqDwesJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to