Xpath Should Match X Times keyword seems to be failing

347 views
Skip to first unread message

dmllc

unread,
Aug 14, 2013, 12:13:25 PM8/14/13
to robotframe...@googlegroups.com
I am trying to verify how many times a webelement is displayed in a jquery overlay. I first use the keyword Wait Until Page Contains Element to verify that the overlay is generated in the DOM. This test case passes. But if I try to get the xpath count of a webelement within the overlay, the test case fails. I even tried to get the count of the overlay id which just passed with Wait Until Page Contains Element, but that fails too.

Wait Until Page Contains Element    id=sales-pop
Xpath Should Match X Times    xpath=//div[@id='sales-pop']    1


11:49:56.111 
FAIL 
InvalidSelectorException: Message: 'The given selector xpath=//div[@id=\'sales-pop\'] is either invalid or does not result in a WebElement. The following error occurred:\nInvalidSelectorError: Unable to locate an element with the xpath expression xpath=//div[@id=\'sales-pop\'] because of the following error:\n[Exception... "The expression cannot be converted to return the specified type."

what am I doing wrong?

Tatu Aalto

unread,
Aug 14, 2013, 12:21:03 PM8/14/13
to robotframe...@googlegroups.com
Ugh

Could you send code snapped from the page where the element should be visible.

-Tatu
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Message has been deleted

dmllc

unread,
Aug 14, 2013, 12:44:04 PM8/14/13
to robotframe...@googlegroups.com



On Wednesday, August 14, 2013 12:21:03 PM UTC-4, Tatu Aalto wrote:
Ugh

Could you send code snapped from the page where the element should be visible.

-Tatu
On 14.8.2013 19:13, dmllc wrote:
I am trying to verify how many times a webelement is displayed in a jquery overlay. I first use the keyword Wait Until Page Contains Element to verify that the overlay is generated in the DOM. This test case passes. But if I try to get the xpath count of a webelement within the overlay, the test case fails. I even tried to get the count of the overlay id which just passed with Wait Until Page Contains Element, but that fails too.

Wait Until Page Contains Element    id=sales-pop
Xpath Should Match X Times    xpath=//div[@id='sales-pop']    1


11:49:56.111 
FAIL 
InvalidSelectorException: Message: 'The given selector xpath=//div[@id=\'sales-pop\'] is either invalid or does not result in a WebElement. The following error occurred:\nInvalidSelectorError: Unable to locate an element with the xpath expression xpath=//div[@id=\'sales-pop\'] because of the following error:\n[Exception... "The expression cannot be converted to return the specified type."

what am I doing wrong?
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Kevin O.

unread,
Aug 14, 2013, 3:08:01 PM8/14/13
to robotframe...@googlegroups.com
Do not use the xpath= prefix. XPath is assumed.
Xpath Should Match X Times    //div[@id='sales-pop']    1
This is also a problem for Get Matching Xpath Count

Kevin

dmllc

unread,
Aug 14, 2013, 3:21:26 PM8/14/13
to robotframe...@googlegroups.com
ive been beating my head on a wall trying to figure out why it wont work. my forehead thanks you!

Ed Manlove

unread,
Aug 15, 2013, 10:03:04 AM8/15/13
to robotframe...@googlegroups.com
I've added an issue ticket to add addition information to the keyword documentation so as to point out that users don't need the xpath= prefix in the xpath arguement.

  https://github.com/rtomac/robotframework-selenium2library/issues/228

Ed
Reply all
Reply to author
Forward
0 new messages