How to get absolute xpath from webElement

i have got the text of web element
and now i need to get current static xpath of this element


TestObject MYob = new TestObject(); 
String xpathname = '//*[contains(text(),"палаточный кемпинг")]'

MYob.addProperty('xpath', ConditionType.EQUALS, xpathname);
def result_text = WebUI.getText(MYob)

I am afraid I don’t understand your question. Which xpath are you looking for?

i need to get this:

Please follow this topic. I have no idea what you try to achieve. Please be more descriptive.

the dinamic xpath of WebElement (it contain my searching text) is:
‘//*[contains(text(),“палаточный кемпинг”)]’

i need to get the static xpath of WebElement(it contain my searching text) using some function/
and end of all i will get this xpath:

Ok I think I know what you mean.

It is quite difficult to build XPath from the WebElement or TestObject. Is static xpath format always the same? I mean, element with id followed by first div element.

maybe YES

I mean, element with id followed by first div element.

I need to get xpath from element which contain searching text
it can be withaut using:'//*[contains(text(),"палаточный кемпинг")]

Show me please the part of HTML code for the element you want to locate. Because you may be able to get absolute XPath of the WebElement, but it is quite dirty solution.

what is better than this?

i need to get absolute xpath

What we can do?

This is the way how to retrieve XPath form WebElement, but I haven’t tried it.

It’s not working

What we can do?