Ask a Question

WaitElement and search from current element

SOLVED
mfremont-smith
New Contributor

WaitElement and search from current element

The WaitElement Documentation states: "To search through the entire page starting from the page’s root element, put a double slash (//) at the beginning of the XPath expression. To start the search from the current element, use a dot (.)."

 

My Problem:

This returns a valid object, but it is very slow. I'm guessing its slow because it starts with double slash (//) which means it searches the entire page, of which there are tons of elements.

 

page.tblCell.WaitElement("//a//i[contains(@class,'fa-search')]")

 

This is my attempt at starting the xpath with a dot(.), but it causes an "object does not exist" error:

 

page.tblCell.WaitElement(".a//i[contains(@class,'fa-search')]")

 


Can someone provide a working example of an xpath expression that starts with a dot (.) ?

2 REPLIES 2
AlexKaras
Community Hero

Hi,

 

I guess that XPath should be like this:

".//a//i[contains(@class,'fa-search')]"

note double slash after dot.

 

Does it help ?

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
mfremont-smith
New Contributor

Yes, that works. Thanks for your reply.

cancel
Showing results for 
Search instead for 
Did you mean: