Tried on your test web page and seems the following xpath works,

//d...@id='disabledTest']/sele...@id='d' and @disabled]

Thus, we can use the xpath directly for the disabled attribute. But
the problem is how to handle the corner cases with all normal cases.

Thanks,

Jian


On Jan 14, 10:25 am, [email protected] wrote:
> Selenium uses attributeLocator instead of xpath for attributes. Could
> you try the xpath directly
> such as
>
> //upper_portion/select...@id='d' and @disabled]
>
> if this works, we can test if this xpath exists to see if the UI
> contains disabled attribute.
>
> Thanks,
>
> Jian
>
> On Jan 14, 10:19 am, Mikhail Koryak <[email protected]> wrote:
>
> > Guys this is actually worse then i thought:
>
> > i changed the page to set the disabled attribute to true with
> > javascript on page load, which firebug claims resulted in this html:
> > <select id="d" disabled="">
> > this is STILL not picked up by xpath. This means  that selenium cant
> > tell if you disabled something in javascript, which is done very
> > often, and i think many people will want to test for it.
> > my test page is here:http://dogself.com/telluriumTest/
>
> > On Jan 14, 9:56 am, Mikhail Koryak <[email protected]> wrote:
>
> > > patch is 
> > > here:http://tellurium-users.googlegroups.com/web/disabled_demo.patch?gsc=l...
>
> > > On Jan 14, 9:55 am, Mikhail Koryak <[email protected]> wrote:
>
> > > > Guys, i found the problem:
>
> > > > If the disabled attribute has no value, then selenium cannot find it
> > > > using the generated xpath. example html would be:
> > > > <select disabled id="d">
> > > > this is allowed by the major browsers.
>
> > > > I have created a testcase for this, but i am connected to the readonly
> > > > repository for tellurium right now, and its painful to switch, so i
> > > > created a patch with the tests which ill attach as a file to the
> > > > group.
>
> > > > As far as the solution goes:
> > > > It may not be possible to do with xpath, in which case, it would be
> > > > good if we changed  the way selenium.jar is started, so that we pass
> > > > in the core-extensions.js file as an arg, and merge in my jquery work.
> > > > after the jquery extensions are in, it will be easy to write a jquery
> > > > workaround for isEnabled and isDisabled functions to call custom js.
>
> > > > On Jan 13, 3:54 pm, "Haroon Rasheed" <[email protected]> wrote:
>
> > > > > I am using the getAttribute() function to get the value of For 
> > > > > property from
> > > > > the label without any problem, did not try for any other property 
> > > > > though.
>
> > > > > -Haroon
>
> > > > > -----Original Message-----
> > > > > From: [email protected]
>
> > > > > [mailto:[email protected]] On Behalf Of
> > > > > [email protected]
> > > > > Sent: Tuesday, January 13, 2009 7:50 PM
> > > > > To: tellurium-users
> > > > > Subject: Re: problem with disabled attribute on a button
>
> > > > > What you get back when call
>
> > > > > getAttribute()
>
> > > > > for the "disabled" attribute? Hope Selenium would not treat "disabled"
> > > > > differently.
>
> > > > > On Jan 13, 12:56 pm, Mikhail Koryak <[email protected]> wrote:
> > > > > > so, it seems that selenium does not like the [] around the attribute
> > > > > > but xpather does.
> > > > > > I tried the same same code but checked for the attribute 'name' and 
> > > > > > it
> > > > > > worked, but 'disabled' does not work. the element DOES have the
> > > > > > disabled attribute.
>
> > > > > > the html looks like this:
>
> > > > > > <select disabled="disabled" name="secondary_group_by"
> > > > > > onchange="disableExportButtons();"><option
> > > > > > value="">------------           </option></select>
>
> > > > > > ill try to put together a testcase
>
> > > > > > On Jan 13, 12:34 pm, Mikhail Koryak <[email protected]> wrote:
>
> > > > > > > Jian,
> > > > > > > I tested this change and it is not working for me. The new xpath 
> > > > > > > that
> > > > > > > is generated cannot be found on page.
>
> > > > > > > What is interesting, is that if i change the xpath to:
> > > > > > > //descendant-or-self::d...@id="filterSortBox"]/descendant-or-
> > > > > > > self::sele...@name="secondary_group_by"]/self::node()[...@disabled]
> > > > > > > (notice the square brackets around disabled)
> > > > > > > this xpath evaluates correctly in xpather firefox plugin, but 
> > > > > > > when i
> > > > > > > made the change in the code selenium reports the following error:
>
> > > > > > > Command request: getAttribute[//descendant-or-self::div
> > > > > > > [...@id="filterSortBox"]/descendant-or-self::select
> > > > > > > [...@name="secondary_group_by"]/self::node()[...@disabled], ] on 
> > > > > > > session
> > > > > > > 364237
> > > > > > > 12:23:02.394 INFO - Got result: ERROR: Selenium failure. Please 
> > > > > > > report
> > > > > > > to the Selenium Users forum athttp://forums.openqa.org, with error
> > > > > > > details from the log window.  The error message is: The 
> > > > > > > expression is
> > > > > > > not a legal expression. on session 364237
>
> > > > > > > also, isDisabled and isEnabled functions will need to be changed 
> > > > > > > in
> > > > > > > UiObject to use this fix.
> > > > > > > Do you have any idea what can be wrong?
> > > > > > > Ill poke around some more, if i cant figure it out ill make a 
> > > > > > > testcase
> > > > > > > to demonstrate the behavior
>
> > > > > > > On Jan 12, 9:59 am, [email protected] wrote:
>
> > > > > > > > Mikhail,
>
> > > > > > > > I think I have fixed the problem and please update your code 
> > > > > > > > from
> > > > > > > > trunk/core to see if the fix
> > > > > > > > works for you.
>
> > > > > > > > The problem comes from the Selenium attributeLocator format:
> > > > > > > > loca...@attribute
> > > > > > > > If you have already had an attribute in the locator, selenium 
> > > > > > > > will not
> > > > > > > > be able to parse
> > > > > > > > the "@attribute" portion correctly.
>
> > > > > > > > The fix is a trick one, instead of use
>
> > > > > > > > loca...@attribute
>
> > > > > > > > we can use
>
> > > > > > > > locator/self::node()@attribute
>
> > > > > > > > The "self::node()" portion refers to the current node itself 
> > > > > > > > and in
> > > > > > > > this way, you will not
> > > > > > > > have any attribute inside the last portion of xpath, i.e., 
> > > > > > > > self::node
> > > > > > > > ().
>
> > > > > > > > Thanks,
>
> > > > > > > > Jian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to