[pyccuracy-dev:514] Custom elements not found

2 views
Skip to first unread message

Matthew

unread,
May 2, 2010, 10:31:08 PM5/2/10
to pyccuracy
I'm using the instructions here http://wiki.github.com/heynemann/pyccuracy/creating-custom-pages
to register certain elements, but it doesn't seem to work.

My pages.py:

self.quick_register("Search Box", "div[class=\"textboxlist\"]")

My acc file:

And I see "Search Box" div

The failure:

And I see "Search Box" div - FAILED - The div with name or id
Search Box does not exist or is not visible.(Resolved to Element //
div[@class = 'textboxlist'])

From the error message, it looks like it's resolving to the correct
element. What am I missing?

Thanks!

--
You received this message because you are subscribed to the Pyccuracy dev list.

To post to this group, send email to pycc...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/pyccuracy?hl=en

Don´t forget to visit the project's JIRA site at http://jira.stormwindproject.org:8080/browse/PYCCURACY.

Guilherme Chapiewski

unread,
May 3, 2010, 12:43:23 AM5/3/10
to pycc...@googlegroups.com
Hi Mattew,

There's a problem with your code. Notice that there are 2 ways of registering elements:

1) self.register_element("Google Search", "//input[@id='btnG']") -- register_element registers an element using its XPath.

2) self.quick_register("My Div", "div.myclass") -- quick_register registers an element using its CSS selector.

That said, you must do one of the following:

1) self.register_element("Search Box", "//div[contains(@class,'textboxlist')]")
2) self.quick_register("Search Box", "div.textboxlist")

It should work fine. Meanwhile I'll try to think about more comprehensive names for those methods.

Cheers,
gc
--
Guilherme Chapiewski
http://gc.blog.br
http://guilherme.pro
http://twitter.com/gchapiewski

Guilherme Chapiewski

unread,
May 3, 2010, 12:58:31 AM5/3/10
to pycc...@googlegroups.com
I updated the documentation to make this difference more clear.

http://wiki.github.com/heynemann/pyccuracy/creating-custom-pages

Matthew

unread,
May 3, 2010, 8:41:13 AM5/3/10
to pyccuracy
Thanks - I'll give that a try.

I'm new to CSS selectors, so I was following the documentation here:
http://www.w3.org/TR/css3-selectors/#selectors

Is there a better reference?

Thanks again,
Matthew

On May 3, 12:58 am, Guilherme Chapiewski
<guilherme.chapiew...@gmail.com> wrote:
> I updated the documentation to make this difference more clear.
>
> http://wiki.github.com/heynemann/pyccuracy/creating-custom-pages
>
> Cheers,
> gc
> --
> Guilherme Chapiewskihttp://gc.blog.brhttp://guilherme.prohttp://twitter.com/gchapiewski
>
> On Mon, May 3, 2010 at 1:43 AM, Guilherme Chapiewski <
>
>
>
> guilherme.chapiew...@gmail.com> wrote:
> > Hi Mattew,
>
> > There's a problem with your code. Notice that there are 2 ways of
> > registering elements:
>
> > 1) self.*register_element*("Google Search", "//input[@id='btnG']") --
> > register_element registers an element using its XPath.
>
> > 2) self.*quick_register*("My Div", "div.myclass") -- quick_register
> > registers an element using its CSS selector.
>
> > That said, you must do one of the following:
>
> > 1) self.register_element("Search Box",
> > "//div[contains(@class,'textboxlist')]")
> > 2) self.quick_register("Search Box", "div.textboxlist")
>
> > It should work fine. Meanwhile I'll try to think about more comprehensive
> > names for those methods.
>
> > Cheers,
> > gc
> > --
> > Guilherme Chapiewski
> >http://gc.blog.br
> >http://guilherme.pro
> >http://twitter.com/gchapiewski
>
> For more options, visit this group athttp://groups.google.com/group/pyccuracy?hl=en
>
> Don´t forget to visit the project's JIRA site athttp://jira.stormwindproject.org:8080/browse/PYCCURACY.

Matthew

unread,
May 3, 2010, 6:52:57 PM5/3/10
to pyccuracy
I tried both of these approaches and I am getting the same error.

I'm using version 1.2.15, which I believe is the latest.


On May 3, 12:43 am, Guilherme Chapiewski
<guilherme.chapiew...@gmail.com> wrote:
> Hi Mattew,
>
> There's a problem with your code. Notice that there are 2 ways of
> registering elements:
>
> 1) self.*register_element*("Google Search", "//input[@id='btnG']") --
> register_element registers an element using its XPath.
>
> 2) self.*quick_register*("My Div", "div.myclass") -- quick_register
> registers an element using its CSS selector.
>
> That said, you must do one of the following:
>
> 1) self.register_element("Search Box",
> "//div[contains(@class,'textboxlist')]")
> 2) self.quick_register("Search Box", "div.textboxlist")
>
> It should work fine. Meanwhile I'll try to think about more comprehensive
> names for those methods.
>
> Cheers,
> gc
> --
> Guilherme Chapiewskihttp://gc.blog.brhttp://guilherme.prohttp://twitter.com/gchapiewski
> For more options, visit this group athttp://groups.google.com/group/pyccuracy?hl=en
>
> Don´t forget to visit the project's JIRA site athttp://jira.stormwindproject.org:8080/browse/PYCCURACY.

Matthew

unread,
May 3, 2010, 6:53:08 PM5/3/10
to pyccuracy
I tried both of these approaches and I am getting the same error.

I'm using version 1.2.15, which I believe is the latest.


On May 3, 12:43 am, Guilherme Chapiewski
<guilherme.chapiew...@gmail.com> wrote:
> Hi Mattew,
>
> There's a problem with your code. Notice that there are 2 ways of
> registering elements:
>
> 1) self.*register_element*("Google Search", "//input[@id='btnG']") --
> register_element registers an element using its XPath.
>
> 2) self.*quick_register*("My Div", "div.myclass") -- quick_register
> registers an element using its CSS selector.
>
> That said, you must do one of the following:
>
> 1) self.register_element("Search Box",
> "//div[contains(@class,'textboxlist')]")
> 2) self.quick_register("Search Box", "div.textboxlist")
>
> It should work fine. Meanwhile I'll try to think about more comprehensive
> names for those methods.
>
> Cheers,
> gc
> --
> Guilherme Chapiewskihttp://gc.blog.brhttp://guilherme.prohttp://twitter.com/gchapiewski
> For more options, visit this group athttp://groups.google.com/group/pyccuracy?hl=en
>
> Don´t forget to visit the project's JIRA site athttp://jira.stormwindproject.org:8080/browse/PYCCURACY.

Guilherme Chapiewski

unread,
May 3, 2010, 9:16:04 PM5/3/10
to pycc...@googlegroups.com
Yes, this is the latest version.

What happens if you execute the XPath in the page you are testing? (you can use XPather Firefox plugin to do so)
Message has been deleted

Matthew

unread,
May 3, 2010, 9:33:24 PM5/3/10
to pyccuracy
Here is what I get when I eval //div[contains(@class, 'textboxlist')]
OR //div[@class='textboxlist']

1. /html/body/form/div[@class='textboxlist' and @id='entSearch']
2. /html/body/form/div[@class='textboxlist' and position()=2]

There are 2 results. Here is my HTML:

<form>
<div class="textboxlist" id="entSearch"></div>
<input type="submit" value="Search" name="subSearch"/>
</form>



On May 3, 9:16 pm, Guilherme Chapiewski
<guilherme.chapiew...@gmail.com> wrote:
> Yes, this is the latest version.
>
> What happens if you execute the XPath in the page you are testing? (you can
> use XPather Firefox plugin to do so)
>
> Cheers,
> gc
> --
Message has been deleted

Guilherme Chapiewski

unread,
May 4, 2010, 8:36:01 AM5/4/10
to pycc...@googlegroups.com
Weird...

Do you mind to zip your test/code and send me? I'll try to execute here and see what happens.
(Sent from my iPhone; please excuse typos.)


On 03/05/2010, at 22:49, Matthew <matthew....@gmail.com> wrote:

> Here is what I get when I eval //div[contains(@class, 'textboxlist')]
> OR //div[@class='textboxlist']
>
> 1. /html/body/form/div[@class='textboxlist' and @id='entSearch']
> 2. /html/body/form/div[@class='textboxlist' and position()=2]
>
> There are 2 results. Here is my HTML:
>
> <form>
> <div class="textboxlist" id="entSearch"></div>
> <input type="submit" value="Search" name="subSearch"/>
> </form>
>
>
>
> On May 3, 9:16 pm, Guilherme Chapiewski
> <guilherme.chapiew...@gmail.com> wrote:
>> Yes, this is the latest version.
>>
>> What happens if you execute the XPath in the page you are testing? (you can
>> use XPather Firefox plugin to do so)
>>
>> Cheers,
>> gc
>> --

Bernardo Heynemann

unread,
May 4, 2010, 8:41:43 AM5/4/10
to pycc...@googlegroups.com
If you get two results, that might be the problem. Pyccuracy will only allow you to use the xpath if it returns ONE and only ONE element.

Not sure if that helps, but if it doesn`t I abide by GC suggestion. If you can send us the code/markup we can try it. Might even be a bug.

Cheers,
Bernardo Heynemann

Matthew

unread,
May 4, 2010, 6:22:43 PM5/4/10
to pyccuracy
Just sent a simplified version of the code to you (removed framework
references). Thank you for taking a look!

On May 4, 8:41 am, Bernardo Heynemann <heynem...@gmail.com> wrote:
> If you get two results, that might be the problem. Pyccuracy will only allow
> you to use the xpath if it returns ONE and only ONE element.
>
> Not sure if that helps, but if it doesn`t I abide by GC suggestion. If you
> can send us the code/markup we can try it. Might even be a bug.
>
> Cheers,
> Bernardo Heynemann
>
> On Tue, May 4, 2010 at 9:36 AM, Guilherme Chapiewski <
>
>
>
>
>
> guilherme.chapiew...@gmail.com> wrote:
> > Weird...
>
> > Do you mind to zip your test/code and send me? I'll try to execute here and
> > see what happens.
>
> > Cheers,
> > gc
> > --
> > Guilherme Chapiewski
> >http://gc.blog.br
> >http://guilherme.pro
> >http://twitter.com/gchapiewski
> > (Sent from my iPhone; please excuse typos.)
>
You received this message because you are subscribed to the Google Groups "pyccuracy" group.
To post to this group, send email to pycc...@googlegroups.com.
To unsubscribe from this group, send email to pyccuracy+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyccuracy?hl=en.

Reply all
Reply to author
Forward
0 new messages