[JBoss JIRA] (ARQGRA-290) testAttributeIsPresent fails on Chrome and PhantomJS
by Juraj Húska (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-290?page=com.atlassian.jira.plugin... ]
Juraj Húska commented on ARQGRA-290:
------------------------------------
There are two options to go with for me:
* alter the {{AttributePresent}} condition in a way that it will work correctly with empy {{style}} and {{name}} attributes
* Use JS interface to retrieve the attribute information on our own, and report this behavior in upstream WebDriver.
Which one would you like to go with guys ?
> testAttributeIsPresent fails on Chrome and PhantomJS
> ----------------------------------------------------
>
> Key: ARQGRA-290
> URL: https://issues.jboss.org/browse/ARQGRA-290
> Project: Arquillian Graphene
> Issue Type: Bug
> Reporter: Lukáš Fryč
> Assignee: Juraj Húska
> Priority: Critical
> Fix For: 2.0.0.Alpha4
>
>
> Test cases:
> {code}
> LocatorAttributeTest.testAttributeIsPresent
> LocatorAttributeTest.testAttributeIsPresentDirectly
> WebElementAttributeTest.testAttributeIsPresent
> WebElementAttributeTest.testAttributeIsPresentDirectly
> ConditionsTestCase.testAttributeIsPresent
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 9 months
[JBoss JIRA] (ARQGRA-290) testAttributeIsPresent fails on Chrome and PhantomJS
by Juraj Húska (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-290?page=com.atlassian.jira.plugin... ]
Juraj Húska commented on ARQGRA-290:
------------------------------------
I developed some tests which indicates that it is an issue of {{WebDriver}} only.
Consider this JS:
{code}
function removeAttr() {
var disabledButtonAttributePresentNoValue = document.getElementById('disabledButtonAttributePresentNoValue');
var disableButtonAttributePresentWithValue = document.getElementById('disableButtonAttributePresentWithValue');
var buttonWithStyleEmptyValue = document.getElementById('buttonWithStyleEmptyValue');
var buttonWithStyleNoValue = document.getElementById('buttonWithStyleNoValue');
var buttonWithNoStyleDefined = document.getElementById('buttonWithNoStyleDefined');
console.log(disabledButtonAttributePresentNoValue.getAttribute('disabled'));
console.log(disableButtonAttributePresentWithValue.getAttribute('disabled'));
console.log(buttonWithStyleEmptyValue.getAttribute('style'));
console.log(buttonWithStyleNoValue.getAttribute('style'));
console.log(buttonWithNoStyleDefined.getAttribute('style'));
}
{code}
for this HTML code:
{code:xml}
<button disabled id="disabledButtonAttributePresentNoValue">disabledButtonAttributePresentWithNoValue</button>
<button disabled="disabled" id="disableButtonAttributePresentWithValue">disableButtonAttributePresentWithValue</button>
<button style="" id="buttonWithStyleEmptyValue">buttonWithStyleEmptyValue</button>
<button style id="buttonWithStyleNoValue">buttonWithStyleNoValue</button>
<button id="buttonWithNoStyleDefined"></button>
{code}
*the output for console is an empty line for each element with attribute defined but with no value set. The output for retrieving of non defined attribute is {{null}}*
However, the {{Chrome WebDriver}} returns for non defined attribute ({{style}}, {{name}}, have not found more so far) empty string and {{HTML Unit}} returns correctly null.
> testAttributeIsPresent fails on Chrome and PhantomJS
> ----------------------------------------------------
>
> Key: ARQGRA-290
> URL: https://issues.jboss.org/browse/ARQGRA-290
> Project: Arquillian Graphene
> Issue Type: Bug
> Reporter: Lukáš Fryč
> Assignee: Juraj Húska
> Priority: Critical
> Fix For: 2.0.0.Alpha4
>
>
> Test cases:
> {code}
> LocatorAttributeTest.testAttributeIsPresent
> LocatorAttributeTest.testAttributeIsPresentDirectly
> WebElementAttributeTest.testAttributeIsPresent
> WebElementAttributeTest.testAttributeIsPresentDirectly
> ConditionsTestCase.testAttributeIsPresent
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 9 months
[JBoss JIRA] (ARQGRA-290) testAttributeIsPresent fails on Chrome and PhantomJS
by Juraj Húska (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-290?page=com.atlassian.jira.plugin... ]
Juraj Húska edited comment on ARQGRA-290 at 3/27/13 11:05 AM:
--------------------------------------------------------------
I developed some tests which indicates that it is an issue of {{WebDriver}} only.
Consider this JS:
{code}
function removeAttr() {
var disabledButtonAttributePresentNoValue = document.getElementById('disabledButtonAttributePresentNoValue');
var disableButtonAttributePresentWithValue = document.getElementById('disableButtonAttributePresentWithValue');
var buttonWithStyleEmptyValue = document.getElementById('buttonWithStyleEmptyValue');
var buttonWithStyleNoValue = document.getElementById('buttonWithStyleNoValue');
var buttonWithNoStyleDefined = document.getElementById('buttonWithNoStyleDefined');
console.log(disabledButtonAttributePresentNoValue.getAttribute('disabled'));
console.log(disableButtonAttributePresentWithValue.getAttribute('disabled'));
console.log(buttonWithStyleEmptyValue.getAttribute('style'));
console.log(buttonWithStyleNoValue.getAttribute('style'));
console.log(buttonWithNoStyleDefined.getAttribute('style'));
}
{code}
for this HTML code:
{code:xml}
<button disabled id="disabledButtonAttributePresentNoValue">disabledButtonAttributePresentWithNoValue</button>
<button disabled="disabled" id="disableButtonAttributePresentWithValue">disableButtonAttributePresentWithValue</button>
<button style="" id="buttonWithStyleEmptyValue">buttonWithStyleEmptyValue</button>
<button style id="buttonWithStyleNoValue">buttonWithStyleNoValue</button>
<button id="buttonWithNoStyleDefined"></button>
{code}
the output for console is an *empty line* for each element with attribute defined but with *no value set*. The output for retrieving of *non defined attribute is {{null}}*
However, the {{Chrome WebDriver}} returns for non defined attribute ({{style}}, {{name}}, have not found more so far) empty string and {{HTML Unit}} returns correctly null.
was (Author: jhuska):
I developed some tests which indicates that it is an issue of {{WebDriver}} only.
Consider this JS:
{code}
function removeAttr() {
var disabledButtonAttributePresentNoValue = document.getElementById('disabledButtonAttributePresentNoValue');
var disableButtonAttributePresentWithValue = document.getElementById('disableButtonAttributePresentWithValue');
var buttonWithStyleEmptyValue = document.getElementById('buttonWithStyleEmptyValue');
var buttonWithStyleNoValue = document.getElementById('buttonWithStyleNoValue');
var buttonWithNoStyleDefined = document.getElementById('buttonWithNoStyleDefined');
console.log(disabledButtonAttributePresentNoValue.getAttribute('disabled'));
console.log(disableButtonAttributePresentWithValue.getAttribute('disabled'));
console.log(buttonWithStyleEmptyValue.getAttribute('style'));
console.log(buttonWithStyleNoValue.getAttribute('style'));
console.log(buttonWithNoStyleDefined.getAttribute('style'));
}
{code}
for this HTML code:
{code:xml}
<button disabled id="disabledButtonAttributePresentNoValue">disabledButtonAttributePresentWithNoValue</button>
<button disabled="disabled" id="disableButtonAttributePresentWithValue">disableButtonAttributePresentWithValue</button>
<button style="" id="buttonWithStyleEmptyValue">buttonWithStyleEmptyValue</button>
<button style id="buttonWithStyleNoValue">buttonWithStyleNoValue</button>
<button id="buttonWithNoStyleDefined"></button>
{code}
*the output for console is an empty line for each element with attribute defined but with no value set. The output for retrieving of non defined attribute is {{null}}*
However, the {{Chrome WebDriver}} returns for non defined attribute ({{style}}, {{name}}, have not found more so far) empty string and {{HTML Unit}} returns correctly null.
> testAttributeIsPresent fails on Chrome and PhantomJS
> ----------------------------------------------------
>
> Key: ARQGRA-290
> URL: https://issues.jboss.org/browse/ARQGRA-290
> Project: Arquillian Graphene
> Issue Type: Bug
> Reporter: Lukáš Fryč
> Assignee: Juraj Húska
> Priority: Critical
> Fix For: 2.0.0.Alpha4
>
>
> Test cases:
> {code}
> LocatorAttributeTest.testAttributeIsPresent
> LocatorAttributeTest.testAttributeIsPresentDirectly
> WebElementAttributeTest.testAttributeIsPresent
> WebElementAttributeTest.testAttributeIsPresentDirectly
> ConditionsTestCase.testAttributeIsPresent
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 9 months
[JBoss JIRA] (ARQGRA-290) testAttributeIsPresent fails on Chrome and PhantomJS
by Juraj Húska (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-290?page=com.atlassian.jira.plugin... ]
Juraj Húska edited comment on ARQGRA-290 at 3/27/13 9:34 AM:
-------------------------------------------------------------
The problem is in somewhere here:
* The assertion of AttributePresent [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...]
* The way of removing attribute by JS [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...]
* The Javadoc of {{WebElement#getAttribute}}: More exactly, this method will return the value of the given attribute, unless that attribute is *not present*, in which case the value of the property with the same name is returned. If *neither value is set, null is returned*. *The "style"* attribute is converted as best can be to a text representation with a trailing semi-colon.
* The JS engine of different browsers, each reacts differently on {{element.removeAttribute}}
Further investigation is needed.
was (Author: jhuska):
IMHO there is problem in how {{WebDriver}} returns the value of some attribute. In those mentioned tests specifically of attribute {{style}}.
The {{style="display: none;"}} attribute is removed in order to make an element visible by JS code in the HTML pages of those tests: [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...].
The condition for asserting an attribute present is [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...].
So we are asserting the returned value to {{null}}.
Copying relevant part of the {{WebDriver#getAttribute}} method's Javadoc:
??Get the value of a the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded. More exactly, this method will return the value of the given attribute, unless that *attribute is not present*, in which case the *value of the property with the same name is returned.* *If neither value is set, null is returned.* The *"style"* attribute is converted as best can be to a text representation with a trailing semi-colon.??
Therefore, I think that we need to change the assertion of the {{AttributeIsPresent}} condition to be in compliance with the {{getAttribute}} method.
*However*, that would not be sufficient. Another problem is that there is difference in JS engines of {{HTMLUnit}} and {{Chrome}}, which causes that removing an attribute is not consistent for all browsers.
IMHO the best option would be to assert element for presence like this:
{{return (attributeValue != null) && (attributeValue.length() != 0) && (!attributeValue.equals(getAttribute()));}}
What do you think guys ?
> testAttributeIsPresent fails on Chrome and PhantomJS
> ----------------------------------------------------
>
> Key: ARQGRA-290
> URL: https://issues.jboss.org/browse/ARQGRA-290
> Project: Arquillian Graphene
> Issue Type: Bug
> Reporter: Lukáš Fryč
> Assignee: Juraj Húska
> Priority: Critical
> Fix For: 2.0.0.Alpha4
>
>
> Test cases:
> {code}
> LocatorAttributeTest.testAttributeIsPresent
> LocatorAttributeTest.testAttributeIsPresentDirectly
> WebElementAttributeTest.testAttributeIsPresent
> WebElementAttributeTest.testAttributeIsPresentDirectly
> ConditionsTestCase.testAttributeIsPresent
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 9 months
[JBoss JIRA] (ARQGRA-290) testAttributeIsPresent fails on Chrome and PhantomJS
by Juraj Húska (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-290?page=com.atlassian.jira.plugin... ]
Juraj Húska edited comment on ARQGRA-290 at 3/27/13 9:12 AM:
-------------------------------------------------------------
IMHO there is problem in how {{WebDriver}} returns the value of some attribute. In those mentioned tests specifically of attribute {{style}}.
The {{style="display: none;"}} attribute is removed in order to make an element visible by JS code in the HTML pages of those tests: [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...].
The condition for asserting an attribute present is [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...].
So we are asserting the returned value to {{null}}.
Copying relevant part of the {{WebDriver#getAttribute}} method's Javadoc:
??Get the value of a the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded. More exactly, this method will return the value of the given attribute, unless that *attribute is not present*, in which case the *value of the property with the same name is returned.* *If neither value is set, null is returned.* The *"style"* attribute is converted as best can be to a text representation with a trailing semi-colon.??
Therefore, I think that we need to change the assertion of the {{AttributeIsPresent}} condition to be in compliance with the {{getAttribute}} method.
*However*, that would not be sufficient. Another problem is that there is difference in JS engines of {{HTMLUnit}} and {{Chrome}}, which causes that removing an attribute is not consistent for all browsers.
IMHO the best option would be to assert element for presence like this:
{{return (attributeValue != null) && (attributeValue.length() != 0) && (!attributeValue.equals(getAttribute()));}}
What do you think guys ?
was (Author: jhuska):
IMHO there is problem in how {{WebDriver}} returns the value of some attribute. In those mentioned tests specifically of attribute {{style}}.
The {{style="display: none;"}} attribute is removed in order to make an element visible by JS code in the HTML pages of those tests: [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...].
The condition for asserting an attribute present is [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...].
So we are asserting the returned value to {{null}}.
Copying relevant part of the {{WebDriver#getAttribute}} method's Javadoc:
??Get the value of a the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded. More exactly, this method will return the value of the given attribute, unless that *attribute is not present*, in which case the *value of the property with the same name is returned.* *If neither value is set, null is returned.* The *"style"* attribute is converted as best can be to a text representation with a trailing semi-colon.??
Therefore, I think that we need to change the assertion of the {{AttributeIsPresent}} condition to be in compliance with the {{getAttribute}} method.
*However*, that would not be sufficient. Another problem is that there is difference in JS engines of {{HTMLUnit}} and {{Chrome}}, which causes that removing an attribute is not consistent for all browsers.
IMHO the best option would be to assert element for presence like this:
{{return (attributeValue != null) && (attributeValue.length() != 0) && (attributeValue.equals(getAttribute()));}}
What do you think guys ?
> testAttributeIsPresent fails on Chrome and PhantomJS
> ----------------------------------------------------
>
> Key: ARQGRA-290
> URL: https://issues.jboss.org/browse/ARQGRA-290
> Project: Arquillian Graphene
> Issue Type: Bug
> Reporter: Lukáš Fryč
> Assignee: Juraj Húska
> Priority: Critical
> Fix For: 2.0.0.Alpha4
>
>
> Test cases:
> {code}
> LocatorAttributeTest.testAttributeIsPresent
> LocatorAttributeTest.testAttributeIsPresentDirectly
> WebElementAttributeTest.testAttributeIsPresent
> WebElementAttributeTest.testAttributeIsPresentDirectly
> ConditionsTestCase.testAttributeIsPresent
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 9 months
[JBoss JIRA] (ARQGRA-290) testAttributeIsPresent fails on Chrome and PhantomJS
by Juraj Húska (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-290?page=com.atlassian.jira.plugin... ]
Juraj Húska commented on ARQGRA-290:
------------------------------------
IMHO there is problem in how {{WebDriver}} returns the value of some attribute. In those mentioned tests specifically of attribute {{style}}.
The {{style="display: none;"}} attribute is removed in order to make an element visible by JS code in the HTML pages of those tests: [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...].
The condition for asserting an attribute present is [here|https://github.com/arquillian/arquillian-graphene/blob/master/graphe...].
So we are asserting the returned value to {{null}}.
Copying relevant part of the {{WebDriver#getAttribute}} method's Javadoc:
??Get the value of a the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded. More exactly, this method will return the value of the given attribute, unless that *attribute is not present*, in which case the *value of the property with the same name is returned.* *If neither value is set, null is returned.* The *"style"* attribute is converted as best can be to a text representation with a trailing semi-colon.??
Therefore, I think that we need to change the assertion of the {{AttributeIsPresent}} condition to be in compliance with the {{getAttribute}} method.
*However*, that would not be sufficient. Another problem is that there is difference in JS engines of {{HTMLUnit}} and {{Chrome}}, which causes that removing an attribute is not consistent for all browsers.
IMHO the best option would be to assert element for presence like this:
{{return (attributeValue != null) && (attributeValue.length() != 0) && (attributeValue.equals(getAttribute()));}}
What do you think guys ?
> testAttributeIsPresent fails on Chrome and PhantomJS
> ----------------------------------------------------
>
> Key: ARQGRA-290
> URL: https://issues.jboss.org/browse/ARQGRA-290
> Project: Arquillian Graphene
> Issue Type: Bug
> Reporter: Lukáš Fryč
> Assignee: Juraj Húska
> Priority: Critical
> Fix For: 2.0.0.Alpha4
>
>
> Test cases:
> {code}
> LocatorAttributeTest.testAttributeIsPresent
> LocatorAttributeTest.testAttributeIsPresentDirectly
> WebElementAttributeTest.testAttributeIsPresent
> WebElementAttributeTest.testAttributeIsPresentDirectly
> ConditionsTestCase.testAttributeIsPresent
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 9 months
[JBoss JIRA] (ARQGRA-290) testAttributeIsPresent fails on Chrome and PhantomJS
by Lukáš Fryč (JIRA)
Lukáš Fryč created ARQGRA-290:
---------------------------------
Summary: testAttributeIsPresent fails on Chrome and PhantomJS
Key: ARQGRA-290
URL: https://issues.jboss.org/browse/ARQGRA-290
Project: Arquillian Graphene
Issue Type: Bug
Reporter: Lukáš Fryč
Assignee: Juraj Húska
Fix For: 2.0.0.Alpha4
Test cases:
{code}
LocatorAttributeTest.testAttributeIsPresent
LocatorAttributeTest.testAttributeIsPresentDirectly
WebElementAttributeTest.testAttributeIsPresent
WebElementAttributeTest.testAttributeIsPresentDirectly
ConditionsTestCase.testAttributeIsPresent
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 9 months