We have a response to your query from Naveen Shekar(
https://www.linkedin.com/in/naveen-shekar-11779430/)
At this situation We have lots of options-
Option 1 : Look for any other attribute which Is not changing every time In that div node like name, class etc. So If this div node has class attribute then we can write xpath as bellow.
//div[@class='post-body entry-content']/div[1]/form[1]/input[1]
Option 2 : We can use absolute xpath (full xpath) where you not need to give any attribute names In xpath.
/html/body/div[3]/div[2]/div[2]/div[2]/div[2]/div[2]/div[2]/div/div[4]/div[1]/div/div/div/div[1]/div/div/div/div[1]/div[2]/div[1]/form[1]/input[1]
Option 3 : We can use starts-with function. In this xpath's ID attribute, "post-body-" part remain same every time.
//div[starts-with(@id,'post-body-')]/div[1]/form[1]/input[1]
Option 4 : We can use contains function. Same way you can use contains function as bellow.
div[contains(@id,'post-body-')]/div
===========================
From Rahul Upadhyay (
https://www.linkedin.com/in/rahul-upadhyay-6562a5141/)
It can be created using "Contains" too with combination of different attributes like text, id, placeholder name, for an instance we can consider an example as
//*[contains(text(),'string')]